Finish writing the Oven class that represents an oven. This class has the variables, constructors and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Finish writing the Oven class that represents an oven. This class has the variables, constructors and methods detailed below. You should write code implementing the methods and constructors so they behave as described. Variables private int maxTemp - the maximum temperature of the oven. This value should not be changed after the oven is constructed. If the temperature is greater than 500 or less than 0, it should be changed to 500. private int current Temp - the current temperature of the oven. Should not be greater than maxTemp or less than 0. Constructors . . . Methods . . public Oven (int maxTemperature, int startTemperature) constructs and an object of type oven with the given maxTemperature and startTemperature. . - public int getMaxTemp() - returns the maxTemp of the oven. public int getCurrent Temp() - returns the current Temp of the oven. public void turnoff() - sets the current Temp of the oven to 0 if the current Temp of the oven is greater than 0. public boolean ison() - return true if current Temp of the oven is greater than 0. public void preheat (int temp) - sets current Temp of the oven to temp. If temp is greater than maxTemp, then set currentTemp to maxTemp. If temp is less than or equal to 0, do nothing. To test your code before submission, use the file runner_Oven.java. Run the main method in the runner Oven class and verify that the program produces the expected output. A sample run is shown below, but you should also try a range of other inputs to test your code more thoroughly. Translate G Google (1) I need some hel... If the runner file does not compile then you should attempt to fix your Oven class before checking your code for a score. Start by checking that the signatures and return types of your Oven methods match the descriptions exactly. You should also not add a main method to your Oven class, since you may not be able to run your code, and it will not be scored correctly when you check it. Sample run Maximum oven temperature: 450 Starting temperature of the oven: 70 New oven with a maximum temperature of 450 and a starting temperature of 70 degrees. To preheat the oven enter "p", to turn the oven off enter "o", to restart enter "r", to quit enter "q" Р Enter the temperature to preheat the oven to: 350 Current temperature of the oven is now 350 degrees. New oven with a maximum temperature of 450 and a starting temperature of 350 degrees. To preheat the oven enter "p", to turn the oven off enter "o", to restart enter "r", to quit enter "q" Turning the oven off. O New oven with a maximum temperature of 450 and a starting temperature of 0 degrees. To preheat the oven enter "p", to turn the oven off enter "o", to restart enter "r", to quit enter "q" q Hint - Start by writing the 3 accessor methods - getMaxTemp, getCurrentTemp and isOn. These methods just need to return the relevant member variables. Once this is done you will be able to compile and run the runner class to test your code. Then you can focus on writing and testing the more difficult remaining methods. XX Files Oven.java runner_Oven.java STATUS 1 2 3 8 9 10 11 4* { 5 6 7 ❤ DANHLARIG 12 13 14 15 16 17 18 19 ▾ 20 21 22 O NOT SUBMITTED 23 24 25 26 27 - 28 29 30 31 import java.util.Scanner; public class runner Oven public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Maximum oven temperature: "); int maxTemp = scan.nextInt (); System.out.println("Starting temperature of the oven :"); int startTemp = scan.nextInt (); Oven oven = new Oven (maxTemp, startTemp); String instruction = ""; while (!instruction.equals("q")) { SAVE SUBMIT System.out.println("New oven with a maximum temperature of " + oven.getMaxTemp() + " and a starting temperature of " + oven.getCurrent Temp () + " degrees."); if (instruction.equals("p")) { System.out.println("To preheat the oven enter \"p\" to turn the oven off enter" + " \"0\", to restart enter \"r\", to quit enter \"q\""); || instruction = scan.next(); System.out.println("Enter the temperature to preheat the oven to: "); scan.nextInt (); int temp oven.preheat (temp); "صاممممعمه System.out.println("Current temperature of the oven is now " + oven.getCurrent Temp() + INSTRUCTIONS RUN CODE GRADING Sample run be able to run your code, and it will not be scored correctly when you check it. → HISTORY Maximum oven temperature: 450 Starting temperature of the of 70 New oven with a maximum tempe To preheat the oven enter "p" Р Enter the temperature to preh 350 Current temperature of the ov New oven with a maximum tempe To preheat the oven enter "p" O Turning the oven off. New oven with a maximum tempe To preheat the oven enter "p" q Hint - Start by writing the 3 accessor methods - getMaxTemp, getCurrentTemp and isOn. These methods just need to return the relevant member variables. Once this is done you will be able to compile and run the runner class to Over.java runner Oven.java 13 14 15 16 17 18 19 ▾ 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 } } Oven oven = new Oven (maxTemp, startTemp); String instruction = ""; while (!instruction.equals("q")) { } System.out.println("New oven with a maximum temperature of " + oven.getMaxTemp() + " and a starting temperature of + oven.getCurrent Temp () + " degrees."); System.out.println("To preheat the oven enter \"p\" , to turn the oven off enter" + "\"0\", to restart enter \"r\", to quit enter \"q\""); instruction = scan.next(); if (instruction.equals("p")) { System.out.println("Enter the temperature to preheat the oven to:"); scan.nextInt (); int temp oven.preheat (temp); } System.out.println("Current temperature of the oven is now " + oven.getCurrent Temp() + " degrees\n"); } else if (instruction.equals("o")) { System.out.println("Turning the oven off. \n"); oven. turnoff (); Tot be scored correctly when you check it. Sample run Maximum oven temperature: 450 Starting temperature of the o 70 New oven with a maximum tempe To preheat the oven enter "p" Р Enter the temperature to preh 350 Current temperature of the ov New oven with a maximum tempe To preheat the oven enter "p" 0 Turning the oven off. New oven with a maximum tempe To preheat the oven enter "p" q Hint - Start by writing the 3 accessor methods - getMaxTemp, getCurrentTemp and isOn. These methods just need to return the relevant member variables. Once this is done you will be able to compile and run the runner class to e G Google Files Oven.java runner Oven.java (1) I need some hel... 1 2 - 3 4 tin ∞0 a 5 6 7 8 9 10 11 12 13 14- 15 16 17 18 19 20 - 21 22 23 24 25 26 ▼ 27 28 29 30 31 32 - 33 34 NOT SUBMITTED SAVE oven private int maxTemp; public class Oven { // Represents the maximum possible temperature of an SUBMIT // Represents the current temperature of an oven private int currentTemp; // Constructs an oven with the given max temp and starting temp. The maximum // temperature of an oven must be greater than 0, but no more than 500. // The starting temperature should be less than or equal to the maximum t // temperature, but no less than 0. public Oven (int maxTemperature, int startTemperature) { } // Returns the maximum temperature of an oven. public int getMaxTemp() { } // Returns the current temperature of an oven. public int getCurrentTemp() { } // Turns an oven off by setting the current temperature to 0. public void turnoff () { } D INSTRUCTIONS RUN CODE GRADING } // Returns the maximum temperature of an oven public int getMaxTemp() } // Returns the current temperature of an oven public int getCurrentTemp() } // Turns an oven off by setting the current temperature to 0. public public void turnoff () } // Returns whether the current temperature of an oven is greater than 0. Should 77 return false if the current temperature is 0. public boolean ison() { } } // Sets the current temperature of an oven to the given value. Remember, // the current temperature should not exceed the max temp. public void preheat (int temp) HISTORY } ENC ( 2:20 AM 10 1J 16 17 18 19 20- 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 - 40 41 42 43 44 45 46 - 47 48 49 50 } // Returns the maximum temperature of an oven public int getMaxTemp() { } // Returns the current temperature of an oven public int getCurrentTemp() { } // Turns an oven off by setting the current temperature to 0. public void turnoff () { } // Returns whether the current temperature of an oven is greater than 0. Should // return false if the current temperature is 0. public boolean ison () { } // Sets the current temperature of an oven to the given value. Remember, // the current temperature should not exceed the temp. public void preheat (int temp) { } INSTRUCTIONS RUN CODE { } // Returns the maximum temperature of an oven public int getMaxTemp() GRADING OneDrive HISTORY } // Returns the current temperature of an oven public int getCurrentTemp() } // Turns an oven off by setting the current temperature to 0. public void turnoff() } // Returns whether the current temperature of an oven is greater than 0. Should // return false if the current temperature is 0. public boolean ison() { } // Sets the current temperature of an oven to the given value. Remember, // the current temperature Screenshot saved The screenshot was added to your OneDrive. Finish writing the Oven class that represents an oven. This class has the variables, constructors and methods detailed below. You should write code implementing the methods and constructors so they behave as described. Variables private int maxTemp - the maximum temperature of the oven. This value should not be changed after the oven is constructed. If the temperature is greater than 500 or less than 0, it should be changed to 500. private int current Temp - the current temperature of the oven. Should not be greater than maxTemp or less than 0. Constructors . . . Methods . . public Oven (int maxTemperature, int startTemperature) constructs and an object of type oven with the given maxTemperature and startTemperature. . - public int getMaxTemp() - returns the maxTemp of the oven. public int getCurrent Temp() - returns the current Temp of the oven. public void turnoff() - sets the current Temp of the oven to 0 if the current Temp of the oven is greater than 0. public boolean ison() - return true if current Temp of the oven is greater than 0. public void preheat (int temp) - sets current Temp of the oven to temp. If temp is greater than maxTemp, then set currentTemp to maxTemp. If temp is less than or equal to 0, do nothing. To test your code before submission, use the file runner_Oven.java. Run the main method in the runner Oven class and verify that the program produces the expected output. A sample run is shown below, but you should also try a range of other inputs to test your code more thoroughly. Translate G Google (1) I need some hel... If the runner file does not compile then you should attempt to fix your Oven class before checking your code for a score. Start by checking that the signatures and return types of your Oven methods match the descriptions exactly. You should also not add a main method to your Oven class, since you may not be able to run your code, and it will not be scored correctly when you check it. Sample run Maximum oven temperature: 450 Starting temperature of the oven: 70 New oven with a maximum temperature of 450 and a starting temperature of 70 degrees. To preheat the oven enter "p", to turn the oven off enter "o", to restart enter "r", to quit enter "q" Р Enter the temperature to preheat the oven to: 350 Current temperature of the oven is now 350 degrees. New oven with a maximum temperature of 450 and a starting temperature of 350 degrees. To preheat the oven enter "p", to turn the oven off enter "o", to restart enter "r", to quit enter "q" Turning the oven off. O New oven with a maximum temperature of 450 and a starting temperature of 0 degrees. To preheat the oven enter "p", to turn the oven off enter "o", to restart enter "r", to quit enter "q" q Hint - Start by writing the 3 accessor methods - getMaxTemp, getCurrentTemp and isOn. These methods just need to return the relevant member variables. Once this is done you will be able to compile and run the runner class to test your code. Then you can focus on writing and testing the more difficult remaining methods. XX Files Oven.java runner_Oven.java STATUS 1 2 3 8 9 10 11 4* { 5 6 7 ❤ DANHLARIG 12 13 14 15 16 17 18 19 ▾ 20 21 22 O NOT SUBMITTED 23 24 25 26 27 - 28 29 30 31 import java.util.Scanner; public class runner Oven public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Maximum oven temperature: "); int maxTemp = scan.nextInt (); System.out.println("Starting temperature of the oven :"); int startTemp = scan.nextInt (); Oven oven = new Oven (maxTemp, startTemp); String instruction = ""; while (!instruction.equals("q")) { SAVE SUBMIT System.out.println("New oven with a maximum temperature of " + oven.getMaxTemp() + " and a starting temperature of " + oven.getCurrent Temp () + " degrees."); if (instruction.equals("p")) { System.out.println("To preheat the oven enter \"p\" to turn the oven off enter" + " \"0\", to restart enter \"r\", to quit enter \"q\""); || instruction = scan.next(); System.out.println("Enter the temperature to preheat the oven to: "); scan.nextInt (); int temp oven.preheat (temp); "صاممممعمه System.out.println("Current temperature of the oven is now " + oven.getCurrent Temp() + INSTRUCTIONS RUN CODE GRADING Sample run be able to run your code, and it will not be scored correctly when you check it. → HISTORY Maximum oven temperature: 450 Starting temperature of the of 70 New oven with a maximum tempe To preheat the oven enter "p" Р Enter the temperature to preh 350 Current temperature of the ov New oven with a maximum tempe To preheat the oven enter "p" O Turning the oven off. New oven with a maximum tempe To preheat the oven enter "p" q Hint - Start by writing the 3 accessor methods - getMaxTemp, getCurrentTemp and isOn. These methods just need to return the relevant member variables. Once this is done you will be able to compile and run the runner class to Over.java runner Oven.java 13 14 15 16 17 18 19 ▾ 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 } } Oven oven = new Oven (maxTemp, startTemp); String instruction = ""; while (!instruction.equals("q")) { } System.out.println("New oven with a maximum temperature of " + oven.getMaxTemp() + " and a starting temperature of + oven.getCurrent Temp () + " degrees."); System.out.println("To preheat the oven enter \"p\" , to turn the oven off enter" + "\"0\", to restart enter \"r\", to quit enter \"q\""); instruction = scan.next(); if (instruction.equals("p")) { System.out.println("Enter the temperature to preheat the oven to:"); scan.nextInt (); int temp oven.preheat (temp); } System.out.println("Current temperature of the oven is now " + oven.getCurrent Temp() + " degrees\n"); } else if (instruction.equals("o")) { System.out.println("Turning the oven off. \n"); oven. turnoff (); Tot be scored correctly when you check it. Sample run Maximum oven temperature: 450 Starting temperature of the o 70 New oven with a maximum tempe To preheat the oven enter "p" Р Enter the temperature to preh 350 Current temperature of the ov New oven with a maximum tempe To preheat the oven enter "p" 0 Turning the oven off. New oven with a maximum tempe To preheat the oven enter "p" q Hint - Start by writing the 3 accessor methods - getMaxTemp, getCurrentTemp and isOn. These methods just need to return the relevant member variables. Once this is done you will be able to compile and run the runner class to e G Google Files Oven.java runner Oven.java (1) I need some hel... 1 2 - 3 4 tin ∞0 a 5 6 7 8 9 10 11 12 13 14- 15 16 17 18 19 20 - 21 22 23 24 25 26 ▼ 27 28 29 30 31 32 - 33 34 NOT SUBMITTED SAVE oven private int maxTemp; public class Oven { // Represents the maximum possible temperature of an SUBMIT // Represents the current temperature of an oven private int currentTemp; // Constructs an oven with the given max temp and starting temp. The maximum // temperature of an oven must be greater than 0, but no more than 500. // The starting temperature should be less than or equal to the maximum t // temperature, but no less than 0. public Oven (int maxTemperature, int startTemperature) { } // Returns the maximum temperature of an oven. public int getMaxTemp() { } // Returns the current temperature of an oven. public int getCurrentTemp() { } // Turns an oven off by setting the current temperature to 0. public void turnoff () { } D INSTRUCTIONS RUN CODE GRADING } // Returns the maximum temperature of an oven public int getMaxTemp() } // Returns the current temperature of an oven public int getCurrentTemp() } // Turns an oven off by setting the current temperature to 0. public public void turnoff () } // Returns whether the current temperature of an oven is greater than 0. Should 77 return false if the current temperature is 0. public boolean ison() { } } // Sets the current temperature of an oven to the given value. Remember, // the current temperature should not exceed the max temp. public void preheat (int temp) HISTORY } ENC ( 2:20 AM 10 1J 16 17 18 19 20- 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 - 40 41 42 43 44 45 46 - 47 48 49 50 } // Returns the maximum temperature of an oven public int getMaxTemp() { } // Returns the current temperature of an oven public int getCurrentTemp() { } // Turns an oven off by setting the current temperature to 0. public void turnoff () { } // Returns whether the current temperature of an oven is greater than 0. Should // return false if the current temperature is 0. public boolean ison () { } // Sets the current temperature of an oven to the given value. Remember, // the current temperature should not exceed the temp. public void preheat (int temp) { } INSTRUCTIONS RUN CODE { } // Returns the maximum temperature of an oven public int getMaxTemp() GRADING OneDrive HISTORY } // Returns the current temperature of an oven public int getCurrentTemp() } // Turns an oven off by setting the current temperature to 0. public void turnoff() } // Returns whether the current temperature of an oven is greater than 0. Should // return false if the current temperature is 0. public boolean ison() { } // Sets the current temperature of an oven to the given value. Remember, // the current temperature Screenshot saved The screenshot was added to your OneDrive.
Expert Answer:
Answer rating: 100% (QA)
Step 1 The definitions of Ovenjava is implemented using Java ... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
! Required information [The following information applies to the questions displayed below.] Celestial Products, Inc., has decided to introduce a new product, which can be manufactured by either a...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The following two equations have a common solution of (1, 2, 3). Which equation would complete a system of three linear equations in three variables having solution set {(1, 2, 3)}? x+y+z=6 2x = y +...
-
Kuchin Company reports the following for the month of June. Instructions(a) Compute the cost of the ending inventory and the cost of goods sold under (1) FIFO,(2) LIFO, and (3) average-cost.(b) Which...
-
The heats of vaporization for water and carbon disulfide are 40.7 kJ/mol and 26.8 kJ/mol, respectively. A vapor (steam) burn occurs when the concentrated vapor of a substance condenses on your skin....
-
A meter stick passes you at a speed of \(0.5 c\). Explain clearly how you would measure the length of this fast-moving object.
-
The following information is extracted from Tara Corporations accounting records: May 1 Received a $6,000, 12%, 90-day note from V. Leigh, a customer. 6 Received a $9,000, 10%, 120-day note from C....
-
Golden Gate University (GGU or Golden Gate) was founded in 1901. It is a private non-profit higher education institution, located in the heart of San Francisco, California. GGU offers professional...
-
Of all the price analysis methodologies that exist, which are the foundational methods. Longing & Shorting. Trading & Investing. Volume & sentiment. On-chain & Macroeconomic. Mean reversion &...
-
Just answer B 17-42. At U of A, promotion from assistant to associate professor requires the equivalent of five points (years) of acceptable performance. Performance reviews are conducted once a...
-
Includes "tour" to a homothetical town Two products The Dot Store Parade and Grocery (towaway have impressive sales 0 Required information MSI's information related to the Toddle Town Tours...
-
Balance of Payments What is the basic accounting principle behind balancing the Balance of Payments account?
-
Equipment Accounts payable Cash Supplies Accounts receivable Year 3 $18,000 2,300 600 Year 2 Year 1 $16,000 $14,000 8,900 9,300 8,200 1,200 1,400 1,700 Notes payable 10,300 Inventory 800 -1,000 .400...
-
You are a small manufacturer who spent $125,000 to produce your product last month. You already had $33,000 in finished goods in inventory and you ended the month with $40,000 worth of finished...
-
Fixed costs of 7 7 0 , 0 0 0 per year and its variable costs are 6 0 % of the unit selling price of $ 1 5 , 6 0 0 . What is the company's break - even point in sales dollars?
-
Write M = [3 5 steps should lead you to the answer: (a) What matrix E subtracts row 1 from row 2 to make row 2 of EM smaller? (b) What matrix F subtracts row 2 of EM from row 1 to reduce row 1 of...
-
Rewrite the code of Figure 7.3 in Ada, Java, or C#. Figure 7.3: template class queue { item items [max_items]; int next_free, next_full, num_items; public: queue () : next_free (0), next_full(0),...
-
If the int variable contains 10, what will the following Java statements display? System.out.println("Test 1" + * 3 * 2.0); System.out.println("Test 2" + * 3 + 2.0); Given these results, explain...
-
Write and fully test a class that represents rational numbers. A rational number can be represented as the ratio of two integer values, a and b, where b is not zero. The class has attributes for the...
-
Draw a picture of an initially empty data structure, as described in the previous exercise, after adding the numbers 2, 8, 4, and 6, in this order.
-
Given an arbitrary frontier portfolio \(w^{*}\), with \(w^{*} eq w^{\mathrm{MVP}}\), there exists a unique frontier portfolio \(w^{\mathrm{zc}}\) such that...
-
In the context of Proposition 3.4, show that \(\mathbb{E}\left[u^{\prime \prime}\left(\widetilde{W}^{*} ight) \widetilde{W}^{*}\left(\tilde{r}-r_{f} ight) ight] \geq 0\) if the utility function \(u\)...
-
Consider a strictly increasing and strictly concave utility function \(u\) and suppose that there exist a risk free asset with return \(r_{f}>0\) and \(N\) risky assets whose returns...
Study smarter with the SolutionInn App