To create a new project, heater-exercise with a new class Heater and declare a single variable temperature of type double. The value of the variable temperature is set to 15.0 using the constructor. Two methods, warmer() and cooler() are used to change the temperature by 5.0 degrees. An accessor method, getTemperature() is also used.
Program Plan:
Write a program in BlueJ to create a new class Heater. In the class, a single variable temperature of type double is used. The value for the field temperature is set to 15.0 using the constructor. The method warmer() increases the temperature by 5 degrees and cooler() decreases the temperature by 5 degrees. The method getTemperature() is used to return the value of the temperature.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- Can you draw a class diagram on the text with the appropriate classes, attributes, methods, and relationships. (Please use the draw.io web site for drawing.) Here are the main classes and their relationships: HoneynetCentralServer Attributes: cronjobInterval Relationships: has many Honeypots has a LogProcessor Honeypot Attributes: ipAddress, sshCredentials Relationships: has many LogEntries LogEntry Attributes: timestamp, message, actionType (e.g., delete, create in FTP), attackLevel (low, medium, or high) Relationships: belongs to a Honeypot LogProcessor (Nodejs tool) Attributes: ruleFilters Methods: processLogEntries(logEntries) Relationships: processes LogEntries MongoDBAtlasDatabase Attributes: connectionString Methods: storeLogEntries(logEntries) Relationships: stores LogEntries ManagementTool (ElectronJS) Attributes: graphicalLibraries, visualLibraries Methods: displayData(data) Relationships: displays data from MongoDBAtlasDatabase ExternalAPI Attributes: apiUrl,…arrow_forwardCreate a new project, cardCredit-exercise, within BlueJ. Create a class, CreditCard, that contains the following fields: • credit - The current available card credit of type double • creditLimit - The card credit limit of type double • numericPin - The (numeric) pin of the credit card of type int • isLoggedIn - A field of type boolean that indicates whether the user is logged in or out Define a constructor that takes two parameters (of the appropriate type) and sets the values of creditLimit and numericPin accordingly. In the constructor the credit field should be initially set equal to the credit limit and the value of isLoggedIn should be set to false. Define the method logIn that takes a pin as a parameter and if this pin is correct sets the isLoggedIn field to true, otherwise print a message to the user indicating that the inserted pin is wrong. Define the method logOut that sets the value of the field isLoggedIn to false. Define an accessor method getCurrentCredit that, only when…arrow_forwardDraw the UML diagram for the class and then implement the class. For more details about UML diagrams see the “UMLNotation.pdf” by Y. Daniel Liang, located in LabFiles folder. Discuss: Should the class Square have a main method? Use lab_02 as the name of this Java Application project.arrow_forward
- “Reverse - engineer” the code to produce an Object Diagram for the Producer and the Consumer classes found in the lower portion of the code. (Ignore the CandP class, it is just the staging for the application.) Using your common sense describe how you could improve the efficiency of this process in a few sentences.arrow_forwardCreate a new project for this program called TestOldMaid and add a class with a main() method. In the project: Copy your Deck and Card class from the earlier project into it. Create a subclass of Deck called OldMaidDeck. It is special because one of the Queens is missing so it only has 51 cards. Create a constructor method that calls the super class constructor, then removes a queen. Override the toString method so it returns the name of the deck and the number of cards in it. Write the test main() method. Create an OldMaidDeck object and deal all the cards to six players. It is ok if not everyone has an equal number of cards. Use arrays or ArrayLists for the players hands. Show the hands of all 6 players. Refer to the web to find out more about the Old Maid card game: https://bicyclecards.com/how-to-play/old-maid/ Fully document all classes with your name, date and description. And each data member and method is documented. Each block that does something is also documented.arrow_forwardCreate a new project for this program called TestOldMaid and add a class with a main() method. In the project: Copy your Deck and Card class from the earlier project into it. Create a subclass of Deck called OldMaidDeck. It is special because one of the Queens is missing so it only has 51 cards. Create a constructor method that calls the super class constructor, then removes a queen. Override the toString method so it returns the name of the deck and the number of cards in it. Write the test main() method. Create an OldMaidDeck object and deal all the cards to six players. It is ok if not everyone has an equal number of cards. Use arrays or ArrayLists for the players hands. Show the hands of all 6 players. Refer to the web to find out more about the Old Maid card game. Fully document all classes with your name, date and description. And each data member and method is documented. Each block that does something is also documented. Without removing the Queensarrow_forward
- (1) Add an __init__ method to the Widget class below. Each object of type Widget should have an instance variable called name and an instance variable called cost that represents a cost in dollars; those values are passed in when an object of type Widget is initialized. (2) Add a method to class Widget called is_cheap that returns True if the cost is less than $10, and False otherwise. (3) Add proper doctrings along with two examples for each method. You may use the Sample Usage code given below in your work.arrow_forwardAdd a new folder named “Model” to the project.6. In the Models folder, add a class named Product.7. Add a few properties like Id, Name, Description, and Price to the product class. The product should also be of some kind and for that, a category model is defined and a CategoryId property is added to the product model.8. Similarly, add a Category model with properties like Id, Name, Description, Pricearrow_forwardjava create a simulation of hospital waiting over a 24 hour period of time by creating two class and a driver class that will implement / utilize the first two classes. the first two classes will be a patience class and waiting room class. a) the patience class will have atleast two attributes : name, time arrived. you can assume patients will only at the top of the hour. The class should have a two argument constructorarrow_forward
- Can I get a help with this in Java please? Introduce a new class, called Borrower to the project. Its purpose is to represent the borrower of the CD. It should have two fields surname and libraryId; where the latter is a mix of letters and numbers, and a suitable constructor with parameters for only these two fields in the order specified above as well as appropriate accessor methods.arrow_forwardConsider a class ScienceFairProjectRating that will be used to help judge a science fair project. The attributes for the new class are The name of the project A unique identification string for the project The name of the person A rating for the creative ability (max. 30) A rating for the scientific thought (max. 30) A rating for thoroughness (max. 15) A rating for technical skills (max. 15) A rating for clarity (max. 10) It will have methods to Get the number of judges Get all the ratings for a particular project Return the total of the ratings for a particular project Return the maximum total rating possible Return a string showing a project’s rating in a format suitable for display Write a method heading for each method. Write preconditions and postconditions for each method. Write some Java statements that test the class. Implement the class.arrow_forwardthe following code is centered around data collection, filtering, and using the Singleton pattern in Java, which is all part of a mockup "student information management system", with its purpose being making mockup new student accounts. I've been having issues using the software “dbeaver” for making java projects. Please organize the below code into an executable project “simulation.student” and given step by step instruction as to how this was done Address.java public class Address {private String _city;private String _state;private String _streetName; // Newprivate int _streetNumber; // Newprivate int _apartmentNumber; // New public Address(String city, String state, int zip, String streetName, int streetNumber, int apartmentNumber) {setCity(city);setState(state);setZip(zip);setStreetName(streetName);setStreetNumber(streetNumber);setApartmentNumber(apartmentNumber);} public String getCity() {return _city;} public void setCity(String city) {_city = city;} public String getState()…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education