Java How to Program, Early Objects (11th Global Edition)
11th Edition
ISBN: 9780134751856
Author: Harvey Deitel, Paul J. Deitel
Publisher: Pearson Global Edition
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 5, Problem 6.1E
What does the following
- 1 // Exercise 5.10: Printing.java
- 2 public class Printing {
- 3 public static void main(String[] args)
- 4 for (int i = 1; i <= 10; i++) {
- 5 for (int j = 1; j <= 5; j++) {
- 6 System.out.print('@');
- 7 }
- 5 for (int j = 1; j <= 5; j++) {
- 4 for (int i = 1; i <= 10; i++) {
- 3 public static void main(String[] args)
- 8
- 9 System.out.println();
- 10 }
- 11 }
- 12 }
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
* CENGAGE MINDTAP
Programming Exercise 3-6
Instructions
BookstoreCredit.java
+
1 import java.util.Scanner;
2 public class BookstoreCredit {
To encourage good grades, Hermosa High School has decided to
public static void main (String args[]) {
// Write your code here
3
award each student a bookstore credit that is 10 times the student's
4
grade point average.
5
}
6
public static void computeDiscount(String name, double gpa) {
// Write your code here
}
In other words, a student with a 3.2 grade point average receives a
8
$32.0 credit.
10
Create an application that prompts a student for a name and grade
11 }
point average, and then passes the values to a method (
12
computeDiscount ) that displays a descriptive message. The
message uses the student's name, echoes the grade point average,
and computes and displays the credit.
An example of the program is shown below:
Enter your name >> John
Enter your gpa >>3.4
John, your
GPA is 3.4, so your credit is $34.0
Grading
Write your Java code in…
Java
fix that problem please.
Chapter 5 Solutions
Java How to Program, Early Objects (11th Global Edition)
Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Prob. 1.6SRECh. 5 - Prob. 1.7SRECh. 5 - State whether each of the following is true or...Ch. 5 - State whether each of the following is true or...Ch. 5 - State whether each of the following is true or...
Ch. 5 - State whether each of the following is true or...Ch. 5 - Prob. 2.5SRECh. 5 - State whether each of the following is true or...Ch. 5 - Prob. 2.7SRECh. 5 - Prob. 3.1SRECh. 5 - Prob. 3.2SRECh. 5 - Write a Java statement or a set of Java statements...Ch. 5 - Prob. 3.4SRECh. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Describe the four basic elements of...Ch. 5 - Compare and contrast the while and for iteration...Ch. 5 - Prob. 3.1ECh. 5 - Compare and contrast the break and continue...Ch. 5 - Find and correct the error(s) in each of the...Ch. 5 - The following code should print whether integer...Ch. 5 - Prob. 5.3ECh. 5 - Find and correct the error(s) in each of the...Ch. 5 - What does the following program do? 1 // Exercise...Ch. 5 - (Find the Smallest Value) Write an application...Ch. 5 - (Calculating the Product of Odd Integers) Write an...Ch. 5 - (Factorials) Factorials are used frequently in...Ch. 5 - (Modified Compound-Interest Program) Modify the...Ch. 5 - (Triangle Printing Program) Write an application...Ch. 5 - (Bar-Chart Printing Program) One interesting...Ch. 5 - (Calculating Sales) An online retailer sells five...Ch. 5 - (Modified Compound-Interest Program) Modify the...Ch. 5 - Assume that i = 1, j = 2, k = 3 and m = 2. What...Ch. 5 - (Calculating the Value of ) Calculate the value of...Ch. 5 - (Pythagorean Triples) A right triangle can have...Ch. 5 - (Modified Triangle-Printing Program) Modify...Ch. 5 - (De Morgans Laws) In this chapter, we discussed...Ch. 5 - (Diamond-Printing Program) Write an application...Ch. 5 - Prob. 21.1ECh. 5 - A criticism of the break statement and the...Ch. 5 - What does the following program segment do? 1 for...Ch. 5 - Describe in general how youd remove any continue...Ch. 5 - Prob. 25.1E
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The following program will compile and run, but it uses poor programming style. Modify the program so that it u...
Absolute Java (6th Edition)
When placed at the end of an IfThenElself statement, this provides default action when none of the ElseIf state...
Starting Out With Visual Basic (7th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
Describe the purpose of the access key attribute and how it supports accessibility.
Web Development and Design Foundations with HTML5 (8th Edition)
Write a program that uses the Purchase class in Listing 5.13 to set the following prices: Oranges: 10 for 2.99 ...
Java: An Introduction to Problem Solving and Programming (7th Edition)
Write an SQL statement to display the last name, first name, and email of any owners of cats. Use a subquery.
Database Concepts (7th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- class overload { int x; double y; void add(int a , int b) { x = a + b; } void add(double c , double d) { y = c + d; } overload() { this.x 0; %3D this.y = 0; } %3D } class Overload_methods { public static void main(String args[]) { overload obj int a = 2; double b - 3.2; obj.add(a, a); obj.add(b, b); System.out.println(obj.x + } = new overload(); + obj.y); } #3Run the codearrow_forwardComputer Sciencearrow_forwardjavaarrow_forward
- JAVA Language Caesar Shift Question: Modify the Caesar class so that it will allow various sized shifts to be used, instead of just a shift of size 3. (Hint: Use an instance variable in the Caesar class to represent the shift, add a constructor to set it, and change the encode method to use it.) import java.util.*; public class TestCipher { public static void main(String[] args) { int shift = 7; Caesar caesar = new Caesar(); String text = "hello world"; String encryptTxt = caesar.encrypt(text); System.out.println(text + " encrypted with shift " + shift + " is " + encryptTxt); } } abstract class Cipher { public String encrypt(String s) { StringBuffer result = new StringBuffer(""); // Use a StringBuffer StringTokenizer words = new StringTokenizer(s); // Break s into its words while (words.hasMoreTokens()) { // For each word in s…arrow_forwardclass class { public static void main(String args[]) { int a =5; int b =10; first: { second: { third: { if(a == b >>1) break second; } System.out.println(a); } System.out.println(b); } } } Give result for the code Java Try to do ASAParrow_forwardpublic class Main{ public static void main(String args[]) { Main m = new Main(); m.go(); } public void go() { Customer c = new Customer("Tom", "Smith"); Order o = new Order(c); o.addItem(new Item("Greeting Card", 1.50, 1)); o.addItem(new Item("Baseball Glove", 54.00, 1)); o.addItem(new Item("Notebook", 2.50, 3)); System.out.println(o); }}arrow_forward
- public class Main5 1 public static void main(String[] args) { inta= butjwant 0 833 please help me i am begineer ir avaarrow_forward48. Consider the following class definition. public class Rectangle { private double length; private double width; public Rectangle () length = 0; width = 0; public Rectangle (double 1, double w) { length = l; width = w; public void set (double 1, double w) { length = 1; width = w; public void print () } System.out.println (length " * + width) ; public double area() return length width; public double perimeter () return 2 * length + 2 width; } Which of the following statements correctly instantiates the Rectangle object myRectangle? (i) myRectangle = new Rectangle (12.5, 6); (ii) Rectangle myRectangle = new Rectangle (12.5, 6); (iii) class Rectangle myRectangle = new Rectangle (12.5, 6); a. Only (i) b. Only (ii) c. Only (ii) d. Both (ii) and (iii)arrow_forwardimport java.util.Scanner; /**This program demonstrates a solution to thePayroll Class programming challenge.*/ public class PayrollDemo{ public static void main(String[] args) { // Variables for input String name; // An employee's name int id; // An employee's ID number double payRate; // An employee's pay rate double hoursWorked; // The number of hours worked // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // Get the employee's name. System.out.print("Enter the employee's name: "); name = keyboard.nextLine(); // Get the employee's ID number. System.out.print("Enter the employee's ID number: "); id = keyboard.nextInt(); // Get the employee's pay rate. System.out.print("Enter the employee's hourly pay rate: "); payRate = keyboard.nextDouble(); // Get the number of hours worked by the employee.…arrow_forward
- PROGRAMMING LANGUAGE: Javaarrow_forward/** * A tester program for the PaintJob class. * public class PaintJobTester { public static void main(String[] args) { PaintJob job = new PaintJob(10.5, 9.0); System.out.printf("Room length: %.1f%n", job.getLength()); System.out.println("Expected: 10.5"); System.out.printf("Room width: %.1f%n", job.getWidth()); System.out.println("Expected: 9.0"); System.out.printf("Surface area: %.2f%n", job.surfaceArea()); System.out.println("Expected: 368.72"); System.out.printf("Paint cost: %.2f%n", job.costOfPaint()); System.out.println("Expected: 39.27"); System.out.printf("Total cost: %.2f%n", job.totalJobCost()); System.out.println("Expected: 139.27"); job.setDimensions(15, 12); System.out.printf("Room length: %.1f%n", job.getLength()); System.out.println("Expected: 15.0"); System.out.printf("Room width: %.1f%n", job.getWidth());…arrow_forwardFix all errors to make the code compile and complete. //MainValidatorA3 public class MainA3 { public static void main(String[] args) { System.out.println("Welcome to the Validation Tester application"); // Int Test System.out.println("Int Test"); ValidatorNumeric intValidator = new ValidatorNumeric("Enter an integer between -100 and 100: ", -100, 100); int num = intValidator.getIntWithinRange(); System.out.println("You entered: " + num + "\n"); // Double Test System.out.println("Double Test"); ValidatorNumeric doubleValidator = new ValidatorNumeric("Enter a double value: "); double dbl = doubleValidator.getDoubleWithinRange(); System.out.println("You entered: " + dbl + "\n"); // Required String Test System.out.println("Required String Test:"); ValidatorString stringValidator = new ValidatorString("Enter a required string: "); String requiredString =…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Computational Software for Intelligent System Design; Author: Cadence Design Systems;https://www.youtube.com/watch?v=dLXZ6bM--j0;License: Standard Youtube License