Concept explainers
Create a Temperature class that internally stores a temperature in degrees Kelvin. Create functions named setTempKe1vin, setTempFahrenheit, and setTempCe1sius that take an input temperature in the specified temperature scale, convert the temperature to Kelvin, and store that temperature in the class member variable. Also, create functions that return the stored temperature in degrees Kelvin, Fahrenheit, or Celsius. Write a main function to test your class. Use the equations shown next to convert between the three temperature scales:
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Absolute C++
- Don't put incorrect code..arrow_forwardSummary In this lab, you create a derived class from a base class, and then use the derived class in a Python program. The program should create two Motorcycle objects, and then set the Motorcycle’s speed, accelerate the Motorcycle object, and check its sidecar status. Instructions Open the file named Motorcycle.py. Create the Motorcycle class by deriving it from the Vehicle class. Call the parent class __init()__ method inside the Motorcycle class's __init()__ method. In theMotorcycle class, create an attribute named sidecar. Write a public set method to set the value for sidecar. Write a public get method to retrieve the value of sidecar. Write a public accelerate method. This method overrides the accelerate method inherited from the Vehicle class. Change the message in the accelerate method so the following is displayed when the Motorcycle tries to accelerate beyond its maximum speed: "This motorcycle cannot go that fast". Open the file named MyMotorcycleClassProgram.py. In the…arrow_forwardAssignment You work at the Computer Science 201L Library, and your boss just bought a bunch of new books for the library! All of the new books need to be cataloged and sorted back on the shelf. You don’t need to keep track of what customer has the book or not, just whether they are checked in or out. Objects You need to create a class called LibraryBook. It needs to have the following member variables, stored privately: string title, string author, and string ISBN. You also need to have a Boolean to store its status whether it’s checked out or not. Call this variable checkedOut. Create a header file and a .cpp file for the LibraryBook class. Call it LibraryBook.cpp and LibraryBook.h For functions, this library book class needs to have: A default constructor setting all strings blank and the checked out status to false A constructor setting all strings through the parameters (title, author, ISBN), and setting the checked out status to false. “Getters” to get the values from the…arrow_forward
- Create a class called Box that has the following attributes: length, width and height and the following two function declarations: setBoxDimensions which accepts three parameters: w, l and h getVolume which has no parameters.arrow_forwardIn C++ Create a class called Pencil. Pencil has a type. Create another class called Customer. The customer class should have a ID number, array (using pointers) called purchases, and a Pencil variable. Make sure to create the purchases array in the constructor. Create a function to fill in purchase amount. Create a way to output all the information about a customer, including all the details about their type of pencil.arrow_forwardCreate functions to test the validity of month, day, year, and store these in a separate file called modVerifyDate:isValidMonth isValidDay isValidYear HINT: for testing the day, this method of the CALENDAR module will be useful: monthrange(year, month) Returns weekday of first day of the month and number of days in month, for the specified year and month. Create an employee class The requirements for the class are as follows: Must have at least 4 private attributes/characteristics – one must be an object of type date Must have getter methods for each of the attributes Must have setter methods for each of the attributes Must have an str method to print the object with appropriate labels for each attribute Must have a constructor ( __init__) Must have a method which calculates using date objects If your class is about employees, calculate the number of years worked given the startDate. Store this in a SEPARATE file called…arrow_forward
- JVarrow_forwarda. Modify the FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating, and the date. The class includes methods to get each field. In addition, create a default constructor that automatically sets the activity to running, the minutes to 0, and the date to January 1 of the current year. Create an application that demonstrates each method works correctly. b. Create an additional overloaded constructor for the FitnessTracker class you created in Exercise 3a. This constructor receives parameters for each of the data fields and assigns them appropriately. Add any needed statements to the TestFitnessTracker.java application to ensure that the overloaded constructor worksarrow_forwardi need the answer quicklyarrow_forward
- Create a class called Complex for performing arithmetic with complex numbers. Complex numbers have the form realPart + imaginaryPart * i where i is -1 Write a program to test your class. Use floating-point variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform the following operations: a) Add two Complex numbers: The real parts are added together and the imaginary parts are added together. b) Subtract two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is sub- tracted from the imaginary part of the left operand. c) Print Complex numbers in the form (a, b), where a is the real part and b is the imaginary part.arrow_forwardthis is question number 2i need answer within 6 or 7 hoursarrow_forwardMake C# (Sharp): console project named MyPlayList. Create an Album class with 4 fields to keep track of title, artist, genre, and copies sold. Each field should have a get/set property. Your Album class should have a constructor to initialize the title (other 3 variables should default to null or 0). In addition, create a public method in the Album class to calculate amount sold for the album (copies sold * cost_of_album). You determine the cost of each album. Also create a method in the Album class to display the information. Print out of information should look something like this: The album Tattoo You by the Rolling Stones, a Rock group, made $25,000,000. In the main method, create 3 instances of the Album class with different albums, use setters to set values of the artist, genre, and copies sold. And then use getters to display information about each on the console.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT