Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 4: Dina's Dinettes 1 Objective This project is the first time you'll create your own objects, along with private data, methods, etc. This isn't

image text in transcribed
image text in transcribed
image text in transcribed
Project 4: Dina's Dinettes 1 Objective This project is the first time you'll create your own objects, along with private data, methods, etc. This isn't a complete working system with a user interface; it's just a chance for you to create classes, thern instantiate and test them. You'll create two classes, one of which uses the other ("has-a" relationship). 2 About Dina's Dinettes Dina's Dinettes sells one type of dinette set. An order consists of one table, zero to ten chairs, and zero to two leaves'. The customer also gets one free item with their order, either (1) a cleaning kit, (2) seat cushions, or (3) padded feet for the table and chairs. The code you'll write is the start of a system to create and process orders and maintain store inventories. 3 Objects You'll Create Here is the UML Class Diagram for the objects you are to create, and how they relate to each other. Please pay attention to notation (including parameter and return types). There's a lot of information here; please understand it all (and ask questions if you're unclear) before starting to code! DinetteStore DinetteOrder bd-you fill in this part tbd-you ill n this part Integer, chairCount: Integer chairlnventory: Inbeger, leatnventoty: Integer) gett ablelnventoryO:Integer getChairlnventoryo: integer .getLeatnventoryO: Integer gatTablesonrdeno: I getChairsOnrdero: Integer .getLeavesonrdero: Integer geTotalSales0:Double .gath gOrderPriceo: Double learcount:Integer, option: Opton DineteOrdenjorderNumber: Intege getOrderumbent): Integer Indeger gett.eatcount): Integer getoption():Option getPrice):Double HIT CUSHIOS setchairCount/chairCount:Integer) submitOrderorder:DinetteOrder):Double toSaingo: string Integet setoption(option: Option tosting):Sting !You're writing Supplier code here, and no Client code. You may want to create a simple Main as a demonstration, but that's not part of the assignment and won't be graded. If you're not familiar with the term used in this context, see the third bullet under the simple definition here Constraints and Assumptions Create no static methods except within test classes. Mark each instance variable and each method as either public or private (and use no other follow the UML where it gives guidance and make smart decisions where it doesn't. Use exactly the method names shown, or instructor test code will fail (if so, you'll lose points). Look carefully at the parameter data types and the return data types; they give you clues. 4 . modifier); .DinneteOrder's order number is like an invoice number; it's not a count of anything. It doesn't auto- increment,it's provided from outside the system. e DinneteOrde r's Option should be an enumerated type. These are discussed in videos and in an appendix at the end of your textbook. The defaults for a DinnetteOrder are: 1 table, 4 chairs, O leaves, and the Cleaning Kit option. DinneteStore's submitOrder maintains the appropriate internal counts and totals, and then returns the price of the order just processed. ("Hey, store, here's an order for you; process it, please!"). Note that for now we aren't storing these orders; handle necessary accounting at submit time. DinneteStore's getAvgOrderPrice calculates and returns the average order price ($0.00 if no orders yet exist). . . The toString functions should do their best to summarize the state of the object instance in questions include newlines in the strings to make the result displayable and attractive. Test all possible methods and state via unit testing. Follow what we did in class to use the JUnit test framework; there's a video on the topic, as well. Write one unit-test class for each production class. Tables are priced at $229.00. Chairs are $69.00 each. Leaves are $45.00 each. . Throw an IllegalArgumentException if any of these preconditions are violated: o Any of the store's initial inventory counts are negative o Inventory is insufficient to cover a submitted order. o The number of chairs or leaves ordered is outside the allowable range (discussed here). o The "usual suspects" are misused (null or empty strings, null object or enum references). 5 Code Implementation Follow the Course Style Guide 6 Testing The testing required here is significant. You may spend as much time writing your test method as you do writing your production code. Your test code needs to test everything your object can do (exception for Ul-heavy code like toString); don't treat it lightly. Don't forget to test constructors and preconditions. And don't forget test code is still code and can have bugs, so be suspicious if everything passes miraculously the first time, i.e., test that you can induce failures and get the appropriate error mnessages shown. 7 Submitting Your Work Use Bluel to create a jar file. Be sure and specify "include source" so your code will be included. Submit the .jar file. 8 Hints . Don't duplicate code; avoid this wherever possible. As an example, don't forget it's legal (and proper) for one constructor to call another constructor; this is good practice and helps avoid duplication and the creation of extra code paths to test. Everything you write in this project is supplier code. You should ask questions of the user nor print anything out for them to see. If you want to provide a simple Main class (with a runnable main method) to show a quick demo, that's fine; printing is okay there. 9 Grading Matrix Achievement Compile/runtime errors Order class Store class Test accessors and mutators Test constructors Test for preconditions, including exception handling Style and Documentation Max 50% 60% 75% 80% 85% 90% 100% Page 3 of 3

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

Step: 3

blur-text-image

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

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago