The first version of Abby’s Eggs worked but was a bit cumbersome. I.e. you couldn’t edit a single parameter, you had to always re-enter all of them.  Store the parameters (number of chickens, eggs laid per day, etc.,) in static fields of the class. Have separate methods for updating the parameters. Use a switch statement to take menu selections for updating parameters or outputting results. If the menu choice is 0, the program should terminate, invalid inputs should be ignored and any prompt repeated. Before displaying updated menu, “clear the screen” I got most of the code working, but I can't find a way to clear the sceen before displaying the updated menu. I tried using "System.out.print("\033[H\033[2J"); System.out.flush();", but it is not working. I am using the Apache NetBeans IDE.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The first version of Abby’s Eggs worked but was a bit cumbersome. I.e. you couldn’t edit a single parameter, you had to always re-enter all of them. 

  1. Store the parameters (number of chickens, eggs laid per day, etc.,) in static fields of the class.
  2. Have separate methods for updating the parameters.
  3. Use a switch statement to take menu selections for updating parameters or outputting results.
  4. If the menu choice is 0, the program should terminate, invalid inputs should be ignored and any prompt repeated.
  5. Before displaying updated menu, “clear the screen”

I got most of the code working, but I can't find a way to clear the sceen before displaying the updated menu. I tried using "System.out.print("\033[H\033[2J"); System.out.flush();", but it is not working. I am using the Apache NetBeans IDE. 

Sample Output:
Number of Chickens: 12
Eggs laid per hen per day: 0.50
Feed Cost Per Pound : $0.25
Feed (lb) Per Hen Per Day: 0.25
Cost Per Carton: $0.50
1. Update Flock
2. Update Eggs Per Hen
3. Update Feed Cost Per Pound
4. Update Feed Per Hen Per Day (lb)
5. Update Egg Carton Cost
6. Show Totals
O. Exit
Enter Selection : 6
Total Eggs: 180.00
Total Feed Cost: $22.50
Total Carton Cost: $7.50
It costs $30.00 to produce 15 dozen eggs
Operating cost per dozen: $2.00
Transcribed Image Text:Sample Output: Number of Chickens: 12 Eggs laid per hen per day: 0.50 Feed Cost Per Pound : $0.25 Feed (lb) Per Hen Per Day: 0.25 Cost Per Carton: $0.50 1. Update Flock 2. Update Eggs Per Hen 3. Update Feed Cost Per Pound 4. Update Feed Per Hen Per Day (lb) 5. Update Egg Carton Cost 6. Show Totals O. Exit Enter Selection : 6 Total Eggs: 180.00 Total Feed Cost: $22.50 Total Carton Cost: $7.50 It costs $30.00 to produce 15 dozen eggs Operating cost per dozen: $2.00
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Math class and its different methods
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education