Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How will you code using java oogle.com/c/MTQ5OTYXNDgxODRa ument N Internships-Northr Diet- Lab (Working with Arraytists) A friend of yours has decided to go on a

image text in transcribed

image text in transcribed

How will you code using java

oogle.com/c/MTQ5OTYXNDgxODRa ument N Internships-Northr Diet- Lab (Working with Arraytists) A friend of yours has decided to go on a diet and has asked you to write a program that will help him track his progress. The program should allow him to make daily entries into a database, where each entry includes the day's date and his current weight. The program should be able to print a summary report which displays the date, weight, and weight differentrial for each entry in the database. The weight differential is the difference between the current weight and the weight recorded on the previous entry. The summary report should also enty in t he datebats represents the amount of weight lassed or gained from the frst Implementation our implementation should include 4 classes: Entry class Diet class Manager class Driver class Entry Class This class represents a single entry into the diet database. It's attributes include a String field for the entry date and a integer field for the weight. You will need to include constructors, accessor methods, and override the toString method. Diet Class s responsible for creating and maintaining the diet database through an Arraylist of Entry objects. iIt defined as the weight difference between two consecutive entrles in the list. If the person weighted 179 on 8-21 and then 177 on 8-22 then the weight differential would be -2. The net weight loss/gain value represents the lossed or gained since the first entry in database. r Diet class should include the following methods (behaviory Default constructor initializes the AddEntry method- adds I Arraylist, weight dilferential, net weight loss/gain variables. he Arraylist, using a linear search ms the Entry object, otherwise it Page 1 algorithm, for an Entry that gle.com/c/MTQSOTYXNDgxODRa ent Intemships Northro given a date (String), this method s algoritkm, for an Entry that contains the specified date. If found it returns the Entry object, otherwise it returns null. ntry meth the date is not found it returns null. This method calls the LinearSearch method getEntry method -given a date (String), it returns the Entry object that contains the specified date. If ViewList method - this method prints a summary report of the database including the list of entrys, the weight differential, and the net weight loss/gain values. Refer to the Sample Output below of entys, the Manager Class This class is the "manager" for the program. It is responsible for displaying and managing its menu system and instariating the Diet object. This class should contain the following methods (behavior): esponsible methods Default Constructor -the constructor should instaniate the Diet object and an Scanner object. It should also call the method MainMenu to start the menu system - should alsonstruetor the object. . MainMenu method- this method is responsible for displaying the main menu for the program AddRecord method a date and weight. this method allows the user to make an entry into the diet database by providing by providing . ViewRecord method this method allows the user to view a single record (Entry) within the database by providing its date. If the entry is not in the database the method should display the message "Entry scord (Entry does not exist ViewAlIRecords method- this method aliows the user to view all of the records in the database including a summary report with the weight differential and the net weight lossigain values. od should displty) within age Entry . Driver Class This method contains the programs main Sample Run method. It initiates the program by instantiating a Manager object Add Record oogle.com/c/MTQ5OTYXNDgxODRa ument N Internships-Northr Diet- Lab (Working with Arraytists) A friend of yours has decided to go on a diet and has asked you to write a program that will help him track his progress. The program should allow him to make daily entries into a database, where each entry includes the day's date and his current weight. The program should be able to print a summary report which displays the date, weight, and weight differentrial for each entry in the database. The weight differential is the difference between the current weight and the weight recorded on the previous entry. The summary report should also enty in t he datebats represents the amount of weight lassed or gained from the frst Implementation our implementation should include 4 classes: Entry class Diet class Manager class Driver class Entry Class This class represents a single entry into the diet database. It's attributes include a String field for the entry date and a integer field for the weight. You will need to include constructors, accessor methods, and override the toString method. Diet Class s responsible for creating and maintaining the diet database through an Arraylist of Entry objects. iIt defined as the weight difference between two consecutive entrles in the list. If the person weighted 179 on 8-21 and then 177 on 8-22 then the weight differential would be -2. The net weight loss/gain value represents the lossed or gained since the first entry in database. r Diet class should include the following methods (behaviory Default constructor initializes the AddEntry method- adds I Arraylist, weight dilferential, net weight loss/gain variables. he Arraylist, using a linear search ms the Entry object, otherwise it Page 1 algorithm, for an Entry that gle.com/c/MTQSOTYXNDgxODRa ent Intemships Northro given a date (String), this method s algoritkm, for an Entry that contains the specified date. If found it returns the Entry object, otherwise it returns null. ntry meth the date is not found it returns null. This method calls the LinearSearch method getEntry method -given a date (String), it returns the Entry object that contains the specified date. If ViewList method - this method prints a summary report of the database including the list of entrys, the weight differential, and the net weight loss/gain values. Refer to the Sample Output below of entys, the Manager Class This class is the "manager" for the program. It is responsible for displaying and managing its menu system and instariating the Diet object. This class should contain the following methods (behavior): esponsible methods Default Constructor -the constructor should instaniate the Diet object and an Scanner object. It should also call the method MainMenu to start the menu system - should alsonstruetor the object. . MainMenu method- this method is responsible for displaying the main menu for the program AddRecord method a date and weight. this method allows the user to make an entry into the diet database by providing by providing . ViewRecord method this method allows the user to view a single record (Entry) within the database by providing its date. If the entry is not in the database the method should display the message "Entry scord (Entry does not exist ViewAlIRecords method- this method aliows the user to view all of the records in the database including a summary report with the weight differential and the net weight lossigain values. od should displty) within age Entry . Driver Class This method contains the programs main Sample Run method. It initiates the program by instantiating a Manager object Add Record

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

what about the fabric case?

Answered: 1 week ago