![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Concept explainers
Design a class named Time. The class contains:
■ The private data fields hour, minute, and second that represent a time.
■ A constructor that constructs a Time object that initializes hour, minute, and second using the current time.
■ The get methods for the data fields hour, minute, and second, respectively.
■ A method named setTime(elapseTime) that sets a new time for the object using the elapsed time in seconds. For example, if the elapsed time is 555550 seconds, the hour is 10, the minute is 19, and the second is 12.
Draw the UML diagram for the class, and then implement the class. Write a test
Your program then prompts the user to enter an elapsed time, sets its elapsed time in the Time object, and displays its hour, minute, and second. Here is a sample run:
Current time is 12:41:6
Enter the elapsed time:55550505
The hour:minute:second for the elapsed time is 22:41:45
![Check Mark](/static/check-mark.png)
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
![Blurred answer](/static/blurred-answer.jpg)
- A class called Book is designed to model a book written by one author. It contains:• Four private instance variables: name (String), author (of the class Author you have justcreated, assume that a book has one and only one author), price (double), and qty (int);• An __init__() to initialize the name, author, price, and qty with the given values;• Getters/Setters: getName(), getAuthor(), getPrice(), setPrice(), getQty(), setQty().• __str__() method that returns printable string of that object with the following format:"Book[name=?,Author[name=?,email=?,gender=?],price=?,qty=?".You should reuse Author’s __str__().Write the Book class (which uses the Author class written earlier). Also write a test drivercodeto test all the methods in the class Book. Take Note that you have to construct an instanceof Author before you can construct an instance of Book. E.g.,ahTeck = Author("Tan Ah Teck", "ahteck@nowhere.com", 'm') # Test the constructorprint(ahTeck) # Test __str__()dummyBook = Book("Java…arrow_forwarda constructor that takes in an int, a string, and a double, constructor will assign them to the ID, name, and Averageinstance variables, then a no-argument (zero-parameter) constructor that will set the ID to the name to “No name assigned” and the Average to –1.0. With an accessor method for the name variable and a mutator method for the average variable. a toString() method that will display all three instance variables on a single line, with a " | " between each one. and then an equals() method that returns true only if all three instance variables are equalarrow_forwardDefine a class named Employee with the following attributes: name, employee_id, department, and position. The Employee class should also have the following methods: __init__(self, name, employee_id, department, position): a constructor method that initializes an Employee object with name, employee_id, department, and position. get_details(self): a method that prints the details of the employee in the following format: "Name: John, ID: 001, Department: IT, Position: Software Engineer". Create a class named EmployeeManagement which will manage a list of Employee objects. This class should have the following methods: add_employee(self, employee): a method that takes an Employee object and adds it to the list of employees. remove_employee(self, employee_id): a method that takes an employee_id and removes the corresponding Employee object from the list. display_all_employees(self): a method that iterates over the list of employees and calls the get_details() method on each Employee…arrow_forward
- 1. Write a class named Coin. The Coin class should have the following field: • A String named sideUp. The sideUp field will hold either "heads" or "tails" indicating the side of the coin that is facing up. The Coin class should have the following methods: • A no-arg constructor that randomly determines the side of the coin that is facing up ("heads" or "tails") and initializes the sideUp field accordingly. • A void method named toss that simulates the tossing of the coin. When the toss method is called, it randomly determines the side of the coin that is facing up ("heads" or "tails") and sets the sideUp field accordingly. • A method named getSide Up that returns the value of the side Up field. Write a program that demonstrates the Coin class. The program should create an instance of the class and display the side that is initially facing up. Then, use a loop to toss the coin 20 times. Each time the coin is tossed, display the side that is facing up. The program should keep count of…arrow_forwardIn java language on netbeans design a console application that will print the game sales for a particular game in 2021. Use an abstract class named Games that contains variables to store the game name, game genre and the total sales. Create a constructor that accepts the game name, game genre and the total game sales as parameters. In this class also create get methods for the variables. The Games class must implement an iGames interface that contains the following: public interface iGames { public void printSales(); public String getGame(); public String getGameGenre(); public int getGameSales(); } Create a subclass called Game Sales that extends the Games class. The Games Sales class must contain a constructor to accept the game name, game genre and total game sales as parameters. Then, write code for the Print Sales method, which prints the game sales report for 2021. Finally, write a Use Games class to instantiate the Games Sales class.arrow_forwardJava:arrow_forward
- class Widget: """A class representing a simple Widget === Instance Attributes (the attributes of this class and their types) === name: the name of this Widget (str) cost: the cost of this Widget (int); cost >= 0 === Sample Usage (to help you understand how this class would be used) === >>> my_widget = Widget('Puzzle', 15) >>> my_widget.name 'Puzzle' >>> my_widget.cost 15 >>> my_widget.is_cheap() False >>> your_widget = Widget("Rubik's Cube", 6) >>> your_widget.name "Rubik's Cube" >>> your_widget.cost 6 >>> your_widget.is_cheap() True """ # Add your methods here if __name__ == '__main__': import doctest # Uncomment the line below if you prefer to test your examples with doctest # doctest.testmod()arrow_forwardThe non-static class level variables and non-static methods of a class are known as a. instance members b. object behaviors c. object attributes O d. object referencesarrow_forwardCreate a class time24, each object is a value represented the time of day in the form hours, minutes and seconds. Provide a constructor that enables an object of this class to be initialized when it is instantiated. The constructor should contain default values in case no initializes are provided. Provide Public member functions for each of the following operations: set the time, print the time, increment the time by one second, compare two times for equality, increment the time by one hour, determine if one time is “less than” (comes before) another time, and final print the time in format 12 hours. Include any additional operations that you think would be useful for your class. Design, implement, and test your classarrow_forward
- Create a class called Staff that has the following attributes: Staff String - FirstName String - LastName String - Department String - Title Integer - UIN Staff() Staff(FirstName, LastName, Department, Title, UIN) getFirstName() - String setFirstName(String) - void getLastName() - String setLastName(String) - void getDepartment() - String setDepartment(String) - void getTitle() - String setTitle(String) - void getUIN() - Integer setUIN(Integer) - void toString() - String compareTo(Staff) - Integer equals(Staff) - Boolean PreviousNextarrow_forwardThe Essay class has a default constructor, a constructor with two parameters, and a constructor with three parameters. Declare the following objects: essay1 with no arguments essay2 with essayTitle and essayAuthor as arguments essay3 with essayTitle, essayAuthor, and essayYear as arguments Ex: If the input is Painting Cole 1919, then the output is: Essay: Undefined, Unspecified, 0 Essay: Painting, Cole, 0 Essay: Painting, Cole, 1919 Archive.java public class Archive { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); StringessayTitle; StringessayAuthor; intessayYear; essayTitle=scnr.next(); essayAuthor=scnr.next(); essayYear=scnr.nextInt(); /* Your code goes here */ essay1.print(); essay2.print(); essay3.print(); } } Essay.java public class Essay { private String title; private String author; private int year; public Essay() { // Default constructor title = "Undefined"; author = "Unspecified"; year = 0; }…arrow_forwardDesign a Book class that holds the title, author’s name, and price of the book. Books’s constructor should initialize all of these data members except the price which is set to 500/-. Create a display method that displays all fields. All Books are priced at 500/- unless they are PopularBooks. The PopularBooks subclass replaces the Bookprice and sets each Book’s price to 50,000/- through PopularBooks construcor. Override the display method to display all fields. Write a Main () method that declares an array of five Book objects. Ask the user to enter the title and author for each of the 5 Books. Consider the Book to be a PopularBook if the author is one of the following: Khaled Hosseini, Oscar Wilde, or Rembrandt. Display the five Books’ details. c sharparrow_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
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)