This project sometimes takes students many, many hours. Please promise yourself that you will reach out to the CS Tutors or your instructor for help if you have already spent 10 or more hours on the project or if you have been stuck for more than 1 hour.
For this project, you get to design and write a FrozenYogurt class that represents a frozen yogurt dessert. You also get to write FrozenYogurtDriver class, a driver class for your FrozenYogurt class.
Design and write your FrozenYogurt class to store the following:
Additionally, name the mutator methods:
Note, a single letter not capitalized will prevent a test case from compiling and running correctly. Double check these method names in your code.
Include, appropriately, the this keyword in your code. Do not use it when it is not required. You may need to create a situation where it is required.
Additionally, include a method named description() that returns a String that describes each of the four fields for the class. Format it as shown at the bottom of the examples below. Note, there should be no parameters to description().
Lastly, write your own custom method with either 1) one or more parameters, 2) a return value or 3) both parameter(s) and a return value.
The role of the FrozenYogurt class is to store the attributes of a frozen yogurt dessert. It could be used to store those values in an interactive session with a user at the keyboard or in a batch environment where other code is just setting values and using it (with no user at the keyboard). Consequently, your FrozenYogurt class should not use a Scanner object at all. Furthermore, you should not use System.out.print() (nor System.out.println()) statements in your FrozenYogurt class. Your Scanner object and calls to System.out.print() and System.out.println() should all be in the FrozenYogurtDriver class.
Design and write a FrozenYogurtDriver class to be a driver for your FrozenYogurt class. Have your driver class welcome the user. Additionally, have the driver class request input to be used to populate two different FrozenYogurt objects then call each of the object's description() method. Additionally, call the custom method that you added on each object. If you want to get additional input from the user (that codePost was not expecting), be sure to do that after displaying everything that’s in the examples (thereby passing the tests). Otherwise, your code will stall at that point in the code and time out. To simplify your code, you can assume that all strings for this project (but not later projects) will be just one word.
Each of the methods (which includes your constructors) in your FrozenYogurt class will be tested using unit tests in codePost. Additionally, the output of your entire program will be tested with various inputs.
codePost does not support the package statement. If your IDE inserted one, I configured codePost to automatically remove it.
Welcome PUT YOUR ORIGINAL WELCOME MESSAGE HERE Please enter the name of the first frozen yogurt: Chocolatey You entered: Chocolatey Please enter the name of the second frozen yogurt: SassyStrawberry You entered: SassyStrawberry Please enter the price for the Chocolatey: 4.99 You entered: 4.99 Please enter the price for the SassyStrawberry: 3.99 You entered: 3.99 Please enter the base yogurt flavor for Chocolatey: chocolate You entered: chocolate Please enter the base yogurt flavor for SassyStrawberry: vanilla You entered: vanilla Please enter the topping to add to Chocolatey: cocoa You entered: cocoa Please enter the topping to add to SassyStrawberry: strawberries You entered: strawberries Frozen Yogurt : Chocolatey Price : $4.99 Yogurt : chocolate Topping : cocoa Frozen Yogurt : SassyStrawberry Price : $3.99 Yogurt : vanilla Topping : strawberries Thank you!
Welcome to the Frozen Yogurt Selector Please enter the name of the first frozen yogurt: VanMango You entered: VanMango Please enter the name of the second frozen yogurt: RockyRoad You entered: RockyRoad Please enter the price for the VanMango: 5.25 You entered: 5.25 Please enter the price for the RockyRoad: 3.89 You entered: 3.89 Please enter the base yogurt flavor for VanMango: vanilla You entered: vanilla Please enter the base yogurt flavor for RockyRoad: chocolate You entered: chocolate Please enter the topping to add to VanMango: Mango You entered: Mango Please enter the topping to add to RockyRoad: Marshmallows You entered: Marshmallows Frozen Yogurt : VanMango Price : $5.25 Yogurt : vanilla Topping : Mango Frozen Yogurt : RockyRoad Price : $3.89 Yogurt : chocolate Topping : Marshmallows Thank you!
Points Item ---------- -------------------------------------------------------------- _____ / 10 Style + Code is indented correctly + Methods should be no longer than 1 page + Documentation: (written for another software developer) * All source code files include header block with description, author, version, etc. * Comments before each method * All non-trivial variables are commented * Comments included before major portions of code _____ / Compiles (max of 50% if it doesn't compile) _____ / 8 Constructor-No Parameters and Accessor Methods Test _____ / 13 Constructor and Accessors Test _____ / 20 Mutators and Accessors Test _____ / 13 description() Test _____ / 21 Input / Output Tests (including creating and using a FrozenYogurt object) _____ / 5 this (Keyword) Test _____ / 8 Custom method (designed and called) _____ / 2 Completed rubric (estimates for each line including hours spent, and signing your name to affirm it's your own work) _____ /100 Total _____ Approximate number of hours spent I, (REPLACE WITH YOUR FULL NAME), affirm that the code that I submitted is my own work and that I did not receive help that was not authorized by the instructor.
Copy and paste the above rubric into a rubric-FrozenYogurt.txt file (not a .docx, .doc nor .rtf file). Think of this as a checklist to ensure that you receive the maximum points possible. For each grade item, fill in your estimate for the grade you deserve. Additionally, include your estimate of how many hours your spent. Lastly, replace, "(REPLACE WITH YOUR FULL NAME)" with your full name to indicate that what you are submitting is entirely your own work.
The submission process has two parts:
Submit your FrozenYogurt class and your FrozenYogurtDriver class to codePost.io.
To register for a free codePost account, please follow these instructions.
You can submit to codePost multiple times if you want.
Only your last submission will be graded.
Watch this short video for a demonstration of submitting an assignment and reviewing the results:
Submit your rubric-FrozenYogurt.txt to the appropriate Assignment tab/folder in CougarVIEW. This is required to receive detailed graded feedback on your project. If you resubmit your rubric, this will effectively replace your previous submission.
_test54735.java:55: error: constructor FrozenYogurt in class FrozenYogurt cannot be applied to given types; FrozenYogurt frozYogurt = new FrozenYogurt( randName, randPrice, randFlavor, randTopping ); ^ required: no arguments found: String,double,String,String reason: actual and formal argument lists differ in lengthor
[codePost Test] ConstructorAndAccessorsTest:42: error: no suitable constructor found for FrozenYogurt(String,double,String,String) FrozenYogurt fyObj = new FrozenYogurt( randName, randPrice, randFlavor, randTopping ); ^ constructor FrozenYogurt.FrozenYogurt() is not applicable (actual and formal argument lists differ in length) constructor FrozenYogurt.FrozenYogurt(<varies by submission>) is not applicable (actual and formal argument lists differ in length)This means that the following code in one of the tests: FrozenYogurt fyObj = new FrozenYogurt( randName, randPrice, randFlavor, randTopping ); was not able to compile because the compiler could not find a constructor in your code that takes a String, double, String and a String as arguments (in that order). The solution is to write such a constructor.