Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I. Following Javadoc Comments: Part A The shell for a Car.java class is available in Desire2Learn. The car.java file is inside a .zip file
I. Following Javadoc Comments: Part A The "shell" for a Car.java class is available in Desire2Learn. The car.java file is inside a .zip file that is posted there. Download that .zip file and extract the contents to save a copy of Car.java. The Car.java file that we have provided includes javadoc comments that explain what code is to be added. There is a javadoc comment for the class itself, as well as a javadoc comment for each instance variable and method. Read these comments carefully, and fill in the missing code (in the proper locations within the file). Implement the car class as it has been described in the javadoc comments. Aside from filling in your name & student number beside the @author tag, you are NOT permitted to alter the comments in any way. Also, include only those instance variables and methods that have been described in the comments; no other instance variables or methods should be added. I. Following Javadoc Comments: Part A The "shell" for a Car.java class is available in Desire2Learn. The car.java file is inside a .zip file that is posted there. Download that .zip file and extract the contents to save a copy of Car.java. The Car.java file that we have provided includes javadoc comments that explain what code is to be added. There is a javadoc comment for the class itself, as well as a javadoc comment for each instance variable and method. Read these comments carefully, and fill in the missing code (in the proper locations within the file). Implement the car class as it has been described in the javadoc comments. Aside from filling in your name & student number beside the @author tag, you are NOT permitted to alter the comments in any way. Also, include only those instance variables and methods that have been described in the comments; no other instance variables or methods should be added. When printing output, make sure that the information is easy to read. Make it clear which information belongs to each car and include appropriate labels. (Remember, whitespace can help with formatting & readability.) Be sure to add a javadoc comment to the top of your CarTestDriver class; include the @author tag (with your name & student number). Once this first question is complete... Create a file containing the output of CarTest Driver (as you did in Lab #2, using redirection at the command line); name this file As2Q1Output.txt. When you later create the .zip archive for this assignment, you will include this output file, as well as the source code for Part A & Part B (i.e. the car.java and CarTestDriver.java files.) Add appropriate headings to your report document for this assignment. Copy & paste into your report the complete source code (the Car.java and CarTestDriver.java files) and the output. II. Creating an Application from Scratch: Part A A local golf course has a clubhouse with a restaurant and bar that members of the club may visit. Any food or drinks that a member orders there are added to a tab, which means that the cost of each of the items ordered is simply added to a running total that the member will pay when they leave the clubhouse at the end of their visit. Write a Java class named Tab that can be used to create & work with Tab objects. For each Tab, we need to keep track of the name of the member who is running the tab (e.g. "Stewart MacDonald"), their seat number (e.g. 12), as well as the total amount owing (which is always 0.00 when the tab is first created when they enter the clubhouse). In the Tab class, include three instance variables and one constructor. The constructor should initialize the instance variables. Provide three simple accessor methods: one to retrieve the member's name, one to retrieve the seat number, and one to retrieve the total amount for all of the charges that have been added to the tab so far. Provide a mutator method that adds the price of a requested menu item to the member's tab. The price of the menu item is passed in through a parameter. (Aside: You may assume that all taxes are already included in the menu prices.) Include one more accessor method that will calculate and return a tip amount when given a percentage. For example, if the patron's current tab was 22.50, and they wanted to leave an 18% tip, the tip amount would be 4.05. This method will accept the percentage as a parameter (e.g. 0.18 for 18%) and return the tip amount. Part B Side note: There are details included in the scenario that is described below that are not needed for the code that you will write. (These details are simply included to help tell the story.) Do not add extra fields or methods to the Tab class (other than those that were mentioned in Part A). Scenario: A group of friends are members of this golf club. They haven't seen one another much over the summer, so they decide to meet up at the clubhouse to share a meal and catch up. Everyone is paying separately so each person will have their own tab. Write and test a Friends Meetup class. This class will serve as a driver program for Part A and should be saved in the same folder as the Tab class. In the main method of the Friends Meetup class, include statements to support the following (in this order): Mike Smith arrives first. He decides to sit at seat 3 and opens a tab. Create a Tab object called mikesTab. Mike orders a Coke, which costs 2.50. Sarah Jones, who wants to sit at the end in seat 1, opens a tab; call this object variable sarahsTab. Sarah orders an iced-tea at a cost of 2.85. Jin Chen sits beside Sarah at seat 2, and he is the next to open a tab; call this object variable jinsTab. Jin chooses a milkshake, at a cost of 5.50. Ella Paul, who sits across from Mike at seat 7, also opens a tab; call this object variable ellasTab. Ella orders an orange juice for herself for 2.75, and then orders a salad for 7.50. (Use two separate statements, one for each purchase.) Sarah then orders the stir-fry, which costs 15.50. . Jin decides to order a plate of nachos; this costs 12.75. Mike is really hungry so he orders the calamari appetizer for 8.75 and a burger, which costs 13.45. (Use two separate statements, one for each purchase.) After Ella finishes her salad she is still hungry so she orders pie for dessert for 4.75. Next, for each of the four Tab objects print out the member's name, the seat number, and the current total amount owing. Suppose Mike wishes to leave a 20% tip. Sarah, feeling slightly less generous, wishes to leave an 18% tip. Jin and Ella both opt to leave 16% tips. Make the appropriate method calls to retrieve the tip amounts for each patron. Print out each of these tip amounts. (Aside: You do NOT need to worry about displaying the tip amounts with exactly 2 decimal digits.) NOTE: In this driver program, be sure to label all of your output so the meanings of the values are clear. (i.e. Don't just print out numbers without explaining what they represent.) You do NOT need to worry about displaying the monetary amounts with exactly 2 decimal digits. Part C Add a javadoc comment to the top of your Friends Meetup class. Include a one- line description of the class as well as the author information (using the @author tag). Add proper javadoc comments to your Tab class as well. For Tab, you should include a comment for the class, as well as a comment for each instance variable and method. The javadoc comment for the class should include an @author tag. Within the javadoc comment for each method, include @param tag(s) if the method has any parameters, as well as an @return tag if there is anything being returned from the method. Run the javadoc utility on your Tab.java file. Recall that, by default, author information and everything that is private is ignored by javadoc. To include this information, you must turn on the appropriate switches by doing this: javadoc -author private Tab.java Do this and then open the resulting Tab.html file in a browser. If you notice any problems with the documentation, go back and fix your javadoc comments and rerun javadoc on your file. Once this question is complete... Create a file containing the output of Friends Meetup: name this file As2Q2Output.txt. When you create the zip archive for this assignment, you will include this output file, as well as the source code (i.e. the Tab.java and Friends Meetup.java files) and the documentation files that were generated when you ran javadoc on Tab.java. (Aside: In addition to the Tab.html file, the javadoc utility created a number of other files and folders. These are used to provide structure/formatting to the documentation. All of those files & folders should be included in the zip file that you submit for this assignment.) Add appropriate headings to your report document for this assignment. Copy & paste into your report the complete source code (the Tab.java and Friends Meetup.java files) and the output. The documentation files that were created when you ran the javadoc utility do not need to be included in your assignment report. (They will only be in the .zip archive.) ii. an archive file (.zip) that contains your Java source code and output for this assignment, as well as the files that were produced by running the javadoc utility on Tab.java in Question II. Make sure that your archive includes all.java files (in case the marker wishes to compile & run your code to test it), both of the output files (with the correct filenames), and all of the files & folders that were created by the javadoc utility. You should not include the report document or the .class files in your archive. This archive should be submitted as a single file to the appropriate submission folder on Desire2Learn. Note: Please name this archive file as follows: YourName_As2_Archive.zip I. Following Javadoc Comments: Part A The "shell" for a Car.java class is available in Desire2Learn. The car.java file is inside a .zip file that is posted there. Download that .zip file and extract the contents to save a copy of Car.java. The Car.java file that we have provided includes javadoc comments that explain what code is to be added. There is a javadoc comment for the class itself, as well as a javadoc comment for each instance variable and method. Read these comments carefully, and fill in the missing code (in the proper locations within the file). Implement the car class as it has been described in the javadoc comments. Aside from filling in your name & student number beside the @author tag, you are NOT permitted to alter the comments in any way. Also, include only those instance variables and methods that have been described in the comments; no other instance variables or methods should be added. I. Following Javadoc Comments: Part A The "shell" for a Car.java class is available in Desire2Learn. The car.java file is inside a .zip file that is posted there. Download that .zip file and extract the contents to save a copy of Car.java. The Car.java file that we have provided includes javadoc comments that explain what code is to be added. There is a javadoc comment for the class itself, as well as a javadoc comment for each instance variable and method. Read these comments carefully, and fill in the missing code (in the proper locations within the file). Implement the car class as it has been described in the javadoc comments. Aside from filling in your name & student number beside the @author tag, you are NOT permitted to alter the comments in any way. Also, include only those instance variables and methods that have been described in the comments; no other instance variables or methods should be added. When printing output, make sure that the information is easy to read. Make it clear which information belongs to each car and include appropriate labels. (Remember, whitespace can help with formatting & readability.) Be sure to add a javadoc comment to the top of your CarTestDriver class; include the @author tag (with your name & student number). Once this first question is complete... Create a file containing the output of CarTest Driver (as you did in Lab #2, using redirection at the command line); name this file As2Q1Output.txt. When you later create the .zip archive for this assignment, you will include this output file, as well as the source code for Part A & Part B (i.e. the car.java and CarTestDriver.java files.) Add appropriate headings to your report document for this assignment. Copy & paste into your report the complete source code (the Car.java and CarTestDriver.java files) and the output. II. Creating an Application from Scratch: Part A A local golf course has a clubhouse with a restaurant and bar that members of the club may visit. Any food or drinks that a member orders there are added to a tab, which means that the cost of each of the items ordered is simply added to a running total that the member will pay when they leave the clubhouse at the end of their visit. Write a Java class named Tab that can be used to create & work with Tab objects. For each Tab, we need to keep track of the name of the member who is running the tab (e.g. "Stewart MacDonald"), their seat number (e.g. 12), as well as the total amount owing (which is always 0.00 when the tab is first created when they enter the clubhouse). In the Tab class, include three instance variables and one constructor. The constructor should initialize the instance variables. Provide three simple accessor methods: one to retrieve the member's name, one to retrieve the seat number, and one to retrieve the total amount for all of the charges that have been added to the tab so far. Provide a mutator method that adds the price of a requested menu item to the member's tab. The price of the menu item is passed in through a parameter. (Aside: You may assume that all taxes are already included in the menu prices.) Include one more accessor method that will calculate and return a tip amount when given a percentage. For example, if the patron's current tab was 22.50, and they wanted to leave an 18% tip, the tip amount would be 4.05. This method will accept the percentage as a parameter (e.g. 0.18 for 18%) and return the tip amount. Part B Side note: There are details included in the scenario that is described below that are not needed for the code that you will write. (These details are simply included to help tell the story.) Do not add extra fields or methods to the Tab class (other than those that were mentioned in Part A). Scenario: A group of friends are members of this golf club. They haven't seen one another much over the summer, so they decide to meet up at the clubhouse to share a meal and catch up. Everyone is paying separately so each person will have their own tab. Write and test a Friends Meetup class. This class will serve as a driver program for Part A and should be saved in the same folder as the Tab class. In the main method of the Friends Meetup class, include statements to support the following (in this order): Mike Smith arrives first. He decides to sit at seat 3 and opens a tab. Create a Tab object called mikesTab. Mike orders a Coke, which costs 2.50. Sarah Jones, who wants to sit at the end in seat 1, opens a tab; call this object variable sarahsTab. Sarah orders an iced-tea at a cost of 2.85. Jin Chen sits beside Sarah at seat 2, and he is the next to open a tab; call this object variable jinsTab. Jin chooses a milkshake, at a cost of 5.50. Ella Paul, who sits across from Mike at seat 7, also opens a tab; call this object variable ellasTab. Ella orders an orange juice for herself for 2.75, and then orders a salad for 7.50. (Use two separate statements, one for each purchase.) Sarah then orders the stir-fry, which costs 15.50. . Jin decides to order a plate of nachos; this costs 12.75. Mike is really hungry so he orders the calamari appetizer for 8.75 and a burger, which costs 13.45. (Use two separate statements, one for each purchase.) After Ella finishes her salad she is still hungry so she orders pie for dessert for 4.75. Next, for each of the four Tab objects print out the member's name, the seat number, and the current total amount owing. Suppose Mike wishes to leave a 20% tip. Sarah, feeling slightly less generous, wishes to leave an 18% tip. Jin and Ella both opt to leave 16% tips. Make the appropriate method calls to retrieve the tip amounts for each patron. Print out each of these tip amounts. (Aside: You do NOT need to worry about displaying the tip amounts with exactly 2 decimal digits.) NOTE: In this driver program, be sure to label all of your output so the meanings of the values are clear. (i.e. Don't just print out numbers without explaining what they represent.) You do NOT need to worry about displaying the monetary amounts with exactly 2 decimal digits. Part C Add a javadoc comment to the top of your Friends Meetup class. Include a one- line description of the class as well as the author information (using the @author tag). Add proper javadoc comments to your Tab class as well. For Tab, you should include a comment for the class, as well as a comment for each instance variable and method. The javadoc comment for the class should include an @author tag. Within the javadoc comment for each method, include @param tag(s) if the method has any parameters, as well as an @return tag if there is anything being returned from the method. Run the javadoc utility on your Tab.java file. Recall that, by default, author information and everything that is private is ignored by javadoc. To include this information, you must turn on the appropriate switches by doing this: javadoc -author private Tab.java Do this and then open the resulting Tab.html file in a browser. If you notice any problems with the documentation, go back and fix your javadoc comments and rerun javadoc on your file. Once this question is complete... Create a file containing the output of Friends Meetup: name this file As2Q2Output.txt. When you create the zip archive for this assignment, you will include this output file, as well as the source code (i.e. the Tab.java and Friends Meetup.java files) and the documentation files that were generated when you ran javadoc on Tab.java. (Aside: In addition to the Tab.html file, the javadoc utility created a number of other files and folders. These are used to provide structure/formatting to the documentation. All of those files & folders should be included in the zip file that you submit for this assignment.) Add appropriate headings to your report document for this assignment. Copy & paste into your report the complete source code (the Tab.java and Friends Meetup.java files) and the output. The documentation files that were created when you ran the javadoc utility do not need to be included in your assignment report. (They will only be in the .zip archive.) ii. an archive file (.zip) that contains your Java source code and output for this assignment, as well as the files that were produced by running the javadoc utility on Tab.java in Question II. Make sure that your archive includes all.java files (in case the marker wishes to compile & run your code to test it), both of the output files (with the correct filenames), and all of the files & folders that were created by the javadoc utility. You should not include the report document or the .class files in your archive. This archive should be submitted as a single file to the appropriate submission folder on Desire2Learn. Note: Please name this archive file as follows: YourName_As2_Archive.zip
Step by Step Solution
★★★★★
3.46 Rating (162 Votes )
There are 3 Steps involved in it
Step: 1
Heres how you can implement them Part A Carjava Part ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started