Find out why the code has errors 4 TestRectangle.java X Source History 1 2 import java.util.Scanner; /*
Fantastic news! We've Found the answer you've been seeking!
Question:
Find out why the code has errors
Transcribed Image Text:
4 TestRectangle.java X Source History 1 2 import java.util.Scanner; /* 23456M /** * 21 22222 23 24 25 27 28 29 30 31 32 33 34 35 36 * @author summers */ public class TestRectangle { public static void displayMenu() { 7 8 9 10 11 12 13 14 15 16 } 17 18 - 19 System.out.println("1. Set length"); System.out.println("2. Set width"); System.out.println("3. Calculate Area"); System.out.println("4. Calculate Perimeter"); System.out.println("5. Exit"); public static void main(String[] args) { Scanner input = new Scanner(System.in); Rectangle rect = new Rectangle(); try { int choice = 0; while (choice != 5) { System.out.println("Enter your choice (1-5):"); choice = input.nextInt(); switch (choice) { case 1: System.out.println("Enter length: "); double length = input.nextDouble(); rect.setLength (length); break; case 2: System.out.println("Enter width: "); double width = input.nextDouble(); rect.setWidth(width); break; 37 case 3: 38 System.out.println("Length 39 40 System.out.println("Width || = || = + rect.getLength()); +rect.getWidth()); System.out.println("Area = + rect.area()); 41 break; 42 case 4: 43 44 45 46 47 case 5: 48 System.out.println("Length System.out.println("Width || = + rect.getLength()); || = + rect.getWidth()); || System.out.println("Perimeter = + rect.perimeter()); break; System.exit(0); 49 > 4 TestRectangle.java X Source History 1 2 import java.util.Scanner; /* 23456M /** * 21 22222 23 24 25 27 28 29 30 31 32 33 34 35 36 * @author summers */ public class TestRectangle { public static void displayMenu() { 7 8 9 10 11 12 13 14 15 16 } 17 18 - 19 System.out.println("1. Set length"); System.out.println("2. Set width"); System.out.println("3. Calculate Area"); System.out.println("4. Calculate Perimeter"); System.out.println("5. Exit"); public static void main(String[] args) { Scanner input = new Scanner(System.in); Rectangle rect = new Rectangle(); try { int choice = 0; while (choice != 5) { System.out.println("Enter your choice (1-5):"); choice = input.nextInt(); switch (choice) { case 1: System.out.println("Enter length: "); double length = input.nextDouble(); rect.setLength (length); break; case 2: System.out.println("Enter width: "); double width = input.nextDouble(); rect.setWidth(width); break; 37 case 3: 38 System.out.println("Length 39 40 System.out.println("Width || = || = + rect.getLength()); +rect.getWidth()); System.out.println("Area = + rect.area()); 41 break; 42 case 4: 43 44 45 46 47 case 5: 48 System.out.println("Length System.out.println("Width || = + rect.getLength()); || = + rect.getWidth()); || System.out.println("Perimeter = + rect.perimeter()); break; System.exit(0); 49 >
Expert Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Legislation Requirements relevant to IR Fair Work Act 2009 Fitness Industry Award 2020 Regulations Requirements relevant to IR Fair Work Regulations 2009 Work Health and Safety Regulation 2012
-
A researcher wanted to find out if there was difference between older movie goers and younger movie goers with respect to their estimates of a successful actors income. The researcher first...
-
If the focal length of a lens is 3 centimeters and the image distance is 5 centimeters from the lens, what is the distance from the object to the lens?
-
You are looking at buying a piece of real estate and you intend to borrow as much as you possibly can from a bank to buy the property. The bank you are dealing with has a requirement that the LVR for...
-
Suppose the War on Poverty were starting anew and you were part of a presidential commission assigned the task of defining the poor. Would you choose an absolute or a relative concept of poverty?...
-
In a ring-protection system, level 0 has the greatest access to objects, and level n (greater than zero) has fewer access rights. The access rights of a program at a particular level in the ring...
-
Absorption and variable costing income statements (Learning Objective 7) (Appendix) Mario's Foods produces frozen meals, which it sells for \(\$ 7\) each. The company uses the FIFO inventory costing...
-
Draw an entity-relationship diagram for the following situation: A commercial bakery makes many different products. These products include breads, desserts, specialty cakes, and many other baked...
-
Mama Italiano Sauce is in the process of preparing a production cost budget for May.The actual costs in April were: Mama Italian Sauce Production Cost Budget Production - Jars of sauce 20,000...
-
Help me 13. [-/0.95 Points] DETAILS SCALC9 3. 1.038 . MY NOTES ASK YOU Find the critical numbers of the function. (Enter your answers as a comma-separated list. If an answer does not exist, enter...
-
Rank the top six biggest risks and issues in relation to using artifcial intelligence.
-
How do digital technologies enhance learning efficiency?
-
What is an example of an expert system use case in the accounting profession?
-
What is the role of digital technologies in learning efficiency?
-
Generally Accepted Accounting Principles (GAAP) are created by the a. Securities and Exchange Commission (SEC). b. Financial Accounting Standards Board (FASB). C. Institute of Management Accountants...
-
I can not upload the Excel file, you can send me your email, I will send you the excel file . C G H K M B D E F Sign for Cost Sign for Cost of Sales Weighted Sign of Purchase (sale = 1, Cost of In...
-
A company produces earbuds. The revenue from the sale of x units of these earbuds is R = 8x. The cost to produce x units of earbuds is C = 3x + 1500. In what interval will the company at least break...
-
Revise cash collections budget (Learning Objective 4) Turn to the original Whitewater Sporting Goods Data Set item 4. Suppose \(70 \%\) of sales are cash and \(30 \%\) are credit. Revise Whitewater's...
-
Revise inventory, purchases, and cost of goods sold budget (Learning Objective 4) Refer to the original Whitewater Sporting Goods Data Set item 5. Suppose cost of goods sold averages \(75 \%\) of...
-
Revise cash payments for purchases (Learning Objective 4) Refer to the original Whitewater Sporting Goods Data Set item 5. Suppose Whitewater Sporting Goods pays for \(60 \%\) of inventory purchases...
Study smarter with the SolutionInn App