Microwave - No Control Flow Time Estimate: 20 hours Video https://www.youtube.com/watch?v=yvysL7agyNA Introduction You will write the software for a microwave without using any control flow, meaning...

i attached my homework. i want 5 test cases with each objective.


Microwave - No Control Flow Time Estimate: 20 hours Video https://www.youtube.com/watch?v=yvysL7agyNA Introduction You will write the software for a microwave without using any control flow, meaning you cannot write any code that will be executed conditionally. Instead you will apply object-orientation programming approaches to make decisions based on types instead of values. Specifically, you are expected to use the state pattern to complete this assignment. The following are banned in your submissions: ● Conditionals ○ if/else if/else ○ match/case ○ throw/try/catch/finally (Can be used to simulate conditionals) ● Loops ○ for ○ while ○ do/while ● Any way of directly simulating Conditionals or Loops that is against the spirit of this assignment. (Ex. Taking advantage of short circuit evaluations) If your submission, including testing, contains any of the keywords listed above it will not be graded. Microwave Specification API The microwave API contains the following methods that you will implement. The “pressed” methods are called when the corresponding button is pressed on the GUI. ● currentInstructions(): Instructions ○ Called by the GUI after each button press and displays the returned value on the screen ○ This method is also called during testing to check if the proper value is displayed without needing the GUI in our unit tests ○ The instructions class contains Int variables for the cook time (in seconds) and the power level that the microwave should currently be executing ● doorOpen(): Boolean ○ Called by the GUI and unit tests to display the state of the door ○ Returns true if the door is currently open, false if it is closed ● openDoor(): Unit ● closeDoor(): Unit ● startPressed(): Unit ● powerLevelPressed(): Unit ● cookTimePressed(): Unit ● thirtySecondsPressed(): Unit ● popcornPressed(): Unit ● clearPressed(): Unit ● numberPressed(number: Int): Unit ○ The parameter is the number of the button that was pressed ○ You can assume the input will always be in the range 0-9 ■ This is a fair assumption since the rest of the program will control calls to this method through the ten number buttons on the GUI. This method is only called directly by our unit tests Functionality Note: Time is frozen for this assignment. You should not account for any passage of time while the microwave has Instructions to cook. The cook time will not change unless an API method is called. The microwave must implement the following functionality: ● Digits 0-9 ○ Initially the digit buttons append the pressed digit to the number of seconds of the cook time. You do not have to compute the minutes:seconds ■ Ex. Pressing [1, 2, 3, “start”] the microwave will cook for 123 seconds ○ If the power level button was pressed, sets the power level to 10 times the pressed digit (0 sets power level to 0, not 100) ● Power level ○ The initial power level is 100 ○ If the user wants to change the power level they will press the power level button, then press a number button for the desired power level. This makes power levels in increments of 10. ○ While entering the power level, the power level is reset with each button press ■ Ex. Pressing [“power level”, 6, 8, 3] will result in a power level of 30 ● Start button ○ Starts the microwave with the entered cookTime and powerLevel ○ Does nothing if the door is open ● Cook time ○ Initial cook time is 0 seconds ○ When the cook time button is pressed the digits button will have their initial behavior - appending to the cook time - and the time is reset to 0 ● Door ○ The door is initially closed and can be opened and closed ○ Whenever the door is open the microwave cannot start running ○ If the door is opened while the microwave is running, stop the microwave. If the door is closed again, the microwave will not automatically start running again. The user must press one of the buttons that will start the microwave again ■ If the microwave is running, the door is opened, then closed, then start is pressed the power level and cook time should be the same as it was before the door opened ○ All other functionality remains while the door is open (Ie. the user can still set cook time and power level with the door open) ● Plus 30 seconds ○ Adds 30 seconds to the cook time ■ Functions whether or not the microwave is running ○ If no cook time has been entered yet, this button also starts the microwave ● Popcorn ○ Pressing the popcorn button sets the power lever to 100, cook time to 140 seconds, and starts the microwave ■ If the door is open the microwave does not start, but the power level and cook time are still set ● Clear ○ Clears the power level and cook time to their initial values ○ Number buttons will enter the cook time after a clear ○ Stops the microwave if it was running ○ Has no effect on the door ● Running ○ When the microwave is running, the Instructions from currentInstructions will contain the power level and cook time according to the functionality above ○ Whenever the microwave is not running these instructions must have a cook time of 0, but the entered values for cook time and power level must be stored in the microwave ○ Whenever the microwave is stopped, the number buttons should append to the current cook time even if a power level was being entered when the microwave started Undefined behaviour There are certain scenarios that have undefined behaviour according to these specs. These behaviors will not be tested in AutoLab and you must not test these in your tests since the expected values are undefined. Do not test any of the following: ● Power level when the microwave is not running ○ As long as the cookTime is 0 the microwave is not running. The power should not be checked in any tests where the expected cookTime is 0 ● Digits, cook time, and power level buttons while the microwave is running ○ Avoid tests that press any of these buttons while the microwave is running ○ [I found out that my microwave has functionality for all these buttons while running. Who knew! Who would keep pressing these buttons after they started the appliance? If you do this, I’d be interested to hear your microwave usage stories] ● Pressing the popcorn button while the microwave is running ● Pressing 0 then +30 ○ Should the microwave start or not? No time was entered so I’d say yes, but my microwave didn't start when I tried it. Let’s leave this undefined and not test it ● Pressing +30 after a clear or power level ○ Should the microwave start or not? No time was entered so it could be argued that it will. We’ll leave this untested allowing you to disable the “start on +30” feature after any button press if you choose (ie. If +30 only starts your microwave if it’s the first button pressed this is ok) ● Pressing Start before entering a time ● Pressing +30 while entering a power level Project Structure Repository: https://github.com/anbaccar/Microwave 1. Clone the starter code from the repository as a new IntelliJ project 2. Look through the code and explore what has been provided 3. You can run the microwave.view.Microwave object to see the provided GUI. Your goal is to add functionality to this GUI 4. Do not edit any code in the view or controller packages 5. You have full control over the model package and this is where you will write all of your code. You may add any methods, variables, classes, objects, or sub-packages you’d like to complete the objectives 6. All testing, including your tests, will only access the microwave.model.Microwave class and will only call methods in the API listed above. You may add more methods/variables/classes/etc, but do not access them from your test suite since they will not exist in my correct/incorrect solutions on AutoLab Objectives Objective 1: Cook Time In the tests package write a test suite named TestCookTime that tests only time cook functionality. This includes using the 10 number buttons to enter a time, all functionality of the +30 seconds button, and the start button. Examples: ● Pressing [3, 0], currentInstructions().cookTime should be 0 ● Pressing [3, 0, “start”], currentInstructions().cookTime should be 30 ● Pressing [“+30”], currentInstructions().cookTime should be 30 Note: You should test more than just these 3 cases. These test cases do not cover all the functionality of this objective. Objective 2: Power Level In the tests package write a test suite named TestPowerLevel that tests the power level functionality. This includes the power level button to enter a power level as well as switching between power level and cook time. Example: ● Pressing [5, 5, “power level”, 5, “start”], cookTime is 55, powerLevel is 50 ● Pressing [5, 5, “power level”, 2, “time cook”, 2, 5, “start”], cookTime is 25, powerLevel is 20 Note: You should test more than just these 2 cases. These test cases do not cover all the functionality of this objective. Objective 3: Full Functionality In the tests package write a test suite named TestFullFunctionality that tests all of the functionality of the microwave. In addition to the previous two objectives this includes opening and closing the door, the clear button, and the popcorn button, and any other functionality defined in this document. This objective contains the same functionality as the primary objective. It is meant to provide you with some feedback as you complete your microwave. Primary Objective The entire microwave functions properly according to all the specifications defined in this document. This objective does not add functionality beyond the other 3 objectives, though your microwave will have to pass my tests, which will be rigorous.
Jul 04, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here