class named Book that contains data fields for the title and number of pages. Include get and set methods for these fields. Next, create a subclass named Textbook, which contains an additional field that holds a grade level for the Textbook and additional
Q: Create a class called Name that represents a person's name. The class should have fields…
A: Class is a user-defined data type. The object is an instance of a class. The object contains the…
Q: 1. Create a class named Employee and create fields to store the following information. Employee ID…
A: Java program to form above Employee class and given questions
Q: Create a class named CollegeCourse that includes data fields that hold the department (for example,…
A: UseCourse.java: import java.util.*;public class UseCourse{ public static void main(String[] args) {…
Q: Next, create class Lab14A with a main method or driver which should do the following: • Create two…
A: Solution: Given,
Q: Create an application named RecoveringDemo that declares objects of three types: Patient,…
A: Introduction of the Program: Like a class, an interface can have data member and member functions…
Q: Create a class called Employee that contains two attributes: name and number. Next, write a class…
A: Given Data, Create a class called Employee that contains two attributes: name and number. Next,…
Q: Create a class named HotelRoom that includes an integer field for the room number and a double field…
A: public class HotelRoom { //decalring instance variables protected int roomNumber; protected double…
Q: Create a class named Ship that has two private fields one for the name (string) of the ship, and the…
A: public class Ship { private String name; private String year; public Ship(String name, String year)…
Q: Create a class named Customer and create fields to store the following information. i. Customer ID…
A: /******************************************************************************…
Q: Create a class named "Identity" class with attributes: name, age, city and gender. Choose your own…
A: Answer: Algorithms: Step1: we have created class person and data member name, age, city and gender…
Q: This is the question I am stuck on - Create a class named Pizza with the following data fields:…
A: Actually, java is a object oriented programming language.. It is a platform independent.
Q: The TManager class will contain only one property - the array of 18 TBooking objects. Write the…
A: An array of objects can store N number of objects of a class. Each object can be referenced using an…
Q: Create a class named FootballTeam. Include two fields that hold data about the teams participating…
A: Note: Three classes has been created for the given criteria. File name: "FootballTeam.java" public…
Q: Design a class named MyPoint to represent a point withx- and y-coordinates. The class contains:■■…
A: UML Diagram:
Q: Write a class Email that contain the following fields, which other classes may not access:
A: Java program: class Email { //instance fields private String to; private String from;…
Q: java Create Class (any class) that include: Three variables Name ( default value is your name )…
A: Need to create class with two variables and one method: Name and Id Method will display the output…
Q: Create a class named Person with three attributes (name, age, address) and provide a constructor to…
A: Java code for the given scenario is as follows: class Person { String name; int age; String…
Q: Write a class called Name that has one instance variable to store the full name of a person. A name…
A: public class Main{ public static void main(String[] args) { Name name = new Name(" Bartleby Expert…
Q: Q1) (The Cylinder class) Design a class named Cylinder The class contains: 1 Two private attributes…
A:
Q: Create an application named PhotoDemo that demonstrates the methods of three related classes for a…
A: Program: using System.IO;using System; //class PhotoDemoclass PhotoDemo{//main methodstatic void…
Q: Create a class named BloodData that includes fields that hold a blood type (the four blood types are…
A: BloodData.java public class BloodData { private String bloodType; private char…
Q: dth (individually and collectively), and get their values individually. There should also be…
A: EXPLANATION Create a class Rectangle, define two fields' length and width. Create getter and…
Q: Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a…
A: In your code you had `1. -------------- these lines which have to be deleted or commented. 2.…
Q: 1. Create a class named Book and declare the fields author, title and pages with suitable field…
A: Note: Since no specific programming language is mentioned, the program has been implemented in Java…
Q: (The Triangle class) Design a class named Triangle that extends GeometricObject. The class contains:…
A: UML stands for unified modeling language standard way to visualize the way a system has been…
Q: 10.4 (The MyPoint class) Design a class named MyPoint to represent a point with X- and…
A: Define a class named "MyPoint". Declare the private variables named "x" and "y" in type of "double".…
Q: P2. In this question, you are provided with a Date class and an incomplete EnhancedDate class. The…
A: import java.io.*; public class Date implements Serializable { // instance variables protected int…
Q: Design a class named Triangle that extends GeometricObject. The class contains: • Three double data…
A: Steps to be followed: Create a class named GeometricObject Declare two variables: String color and…
Q: 1- A variable of class type (i.e., object) always require the same amount of memory to store its…
A: 1- A variable of class type (i.e., object) always require the same amount of memory to store its…
Q: 1. Create a class named Student that has fields for an ID number (idNumber), number of credit hours…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED JAVA FOR THE SOLUTION. Import…
Q: 1) Define a Person class containing two private attributes: last name, first name. Provide this…
A: As per our guidelines, we are supposed to answer only 1st three parts. Kindly repost the remaining…
Q: Create a TeeShirt class for Toby’s Tee Shirt Company. Fields include: orderNumber - of type int…
A: Program code: filename: TeeShirt.java //define a class TeeShirt public class TeeShirt {…
Q: ) Create an enumeration named Departments that contain four sets of values FINANCE, HR, IT, and…
A: Actually, string is a sequence of characters.
Q: Create a constructor named Exam that assigns "Good luck" to a previously declared String variable…
A: we give this argument solution code in next step, we describe all argument code line by line, this…
Q: 1. Write a class named Triangle, containing: Three double data fields named side1, side2, and side3…
A: Make sure you specify both the files in the same package and here, the package name is com.company.
Q: Create a class named Book that contains data fields for the title and number of pages. Include get…
A: public class Book { //declaring instance variables private String title; private int pages;…
Q: Create a subclass named Square from the superclass GeometricObject. Create an instance variable…
A: GeometricObject.java public abstract class GeometricObject {private String color = "white";private…
Q: Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a…
A: The main objective of the program is to create five java classes namely as below Rock.java…
Q: Create a subclass named Square from the superclass GeometricObject. Create an instance variable…
A: Sub Class is a class which inherits the other class. It is also called a derived class or child…
Q: Create a Driver class to use your Farm and Animal classes and create instances of them. In the main…
A: Animal.java //this class encapsulates all the parameters of an animal.// All function names are self…
Q: Define a Person class containing two private attributes: last name, first name. Provide this class…
A: Actually, program is an executable software that runs on a computer.
Q: My professor has given me additional information for this question: Create a class named…
A: Objective: This program creates an application for the College courses along with several…
Q: hoose necessary patters, draw the UML and code just company class methods on paper. A car company…
A: [Since no language is mentioned, C++ is used for implementing the code.] Using the UML notation, the…
Q: Create a class that holds data about a job applicant. Include a name, a phone number, and four…
A: public class JobApplicant{ //declaring data members private String name; private long…
Q: 1. i. Create a class called FootballTeam, with the following data fields • Match_id • Date_of_match…
A: /******************************************************************************…
Q: Design a class named Rectangle to represent a rectangle.
A: public class Main{ public static void main(String[] args) { //create Rectangle using no arg…
Q: Create an application named ShapesDemo that creates several objects that descend from an abstract…
A: Solution: As per the requirement submitted above , kindly find the below solution. Here a new…
Q: Create a class named Person that holds the following fields: two String objects for the person’s…
A: Person.java //import packages import java.time.LocalDate; //class Person public class Person {…
Q: Which of the statements regarding the super keyword is incorrect? You can use super to invoke a…
A: What is super Keyword? The super key-word is used to get entry to the member variables and the…
Q: 1 Create a module named numericquestions. Inside the comdule create NumericQuestion class as a…
A: Answer: our instruction is answer the first three part from the first part and . I have attached…
Create a class named Book that contains data fields for the title and number of pages. Include get and set methods for these fields. Next, create a subclass named Textbook, which contains an additional field that holds a grade level for the Textbook and additional
methods to get and set the grade level field. Write an application that demonstrates using objects of each class
Step by step
Solved in 2 steps with 1 images
- a. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly. Create a Fraction class with fields that hold a whole number, a numerator, and a denominator. In addition: Create properties for each field. The set access or for the denominator should not allow a 0 value; the value defaults to 1. Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.) Add a Reduce() method that reduces a Fraction if it is in improper form. For example, 2/4 should be reduced to 1/2. Add an operator+() method that adds two Fractions. To add two fractions, first eliminate any whole number part of the value. For example, 2 1/4 becomes 9/4 and 1 3/5 becomes 8/5. Find a common denominator and convert the fractions to it. For example, when adding 9/4 and 8/5, you can convert them to 45/20 and 32/20. Then you can add the numerators, giving 77/20. Finally, call the Reduce() method to reduce the result, restoring any whole number value so the fractional part of the number is less than 1. For example, 77/20 becomes 3 17/20. Include a function that returns a string that contains a Fraction in the usual display format—the whole number, a space, the numerator, a slash (D, and a denominator. When the whole number is 0, just the Fraction part of the value should be displayed (for example, 1/2 instead of 0 1/2). If the numerator is 0, just the whole number should be displayed (for example, 2 instead of 2 0/3). b. Add an operator*() method to the Fraction class created in Exercise 11a so that it correctly multiplies two Fractions. The result should be in proper, reduced format. Demonstrate that the method works correctly in a program named FractionDemo2. c. Write a program named FractionDem03 that includes an array of four Fractions. Prompt the user for values for each. Display every possible combination of addition results and every possible combination of multiplication results for each Fraction pair (that is, each type will have 16 results).Create an application class named LetterDemo that instantiates objects of two classes named Letter and CertifiedLetter and that demonstrates all their methods. The classes are used by a company to keep track of letters they mail to clients. The Letter class includes auto-implemented properties for the name of the recipient and the date mailed. Also, include a ToString() method that overrides the Object classs ToString() method and returns a string that contains the name of the class (using CetType and the Letters data field values. Create a child class named CertifiedLetter that includes an auto-implemented property that holds a tracking number for the letter.In Chapter 9, you created a Contestant class for the Greenville Idol competition. The class includes a contestants name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three subclasses: ChildContestant, TeenContestant, and AdultContestant. Child contestants are 12 years old and younger, and their entry fee is $15. Teen contestants are between 13 and 17 years old, inclusive, and their entry fee is S20. Adult contestants are 18 years old and older, and their entry fee is $30. In each subclass, set the entry fee field to the correct value, and override the Tostring() method to return a string that includes all the contestant data, including the age category and the entry fee. Modify the GreenvilleRevenue program so that it performs the following tasks: The program prompts the user for the number of contestants in this years competition, which must be between 0 and 30. The program continues to prompt the user until a valid value is entered. The program prompts the user for names, ages, and talent codes for the contestants entered. Along with the prompt for a talent code, display a list of valid categories. Based on the age entered for each contestant, create an object of the correct type (adult, teen, or child), and store it in an array of Contestant objects. After data entry is complete, display the total expected revenue, which is the sum of the entry fees for the contestants. After data entry is complete, display the valid talent categories and then continuously prompt the user for talent codes, and display all the data for all the contestants in each category. Display an appropriate message if the entered code is not a character or a valid code.
- Create a class named Person that holds the following fields: two String objects for the person’s first and last name and a LocalDate object for the person’s birthdate. Create a class named Couple that contains two Person objects. Create a class named Wedding for a wedding planner that includes the date of the wedding, the Couple being married, and a String for the location. Provide constructors for each class that accept parameters for each field, and provide get methods for each field.Create a class named Person that holds the following fields: two String objectsfor the person’s first and last name and a LocalDate object for the person’sbirthdate. Create a class named Couple that contains two Person objects. Create aclass named Wedding for a wedding planner that includes the date of the wedding,the names of the Couple being married, and a String for the location. Provideconstructors for each class that accept parameters for each field, and provide getmethods for each field. Then write a program that creates two Wedding objectsand in turn passes each to a method that displays all the details. Save the files asPerson.java, Couple.java, Wedding.java, and TestWedding.java.Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and a Rh factor (the factors are + and –). Create a default constructor that sets the fields to O and +, and an overloaded constructor that requires values for both fields. Include get and set methods for each field. Create a class named Patient that includes id, age, and bloodData fields. Provide a default constructor that sets the ID number to 0, the age to 0, and the BloodData values to O and +. Create an overloaded constructor that provides values for each field. Also provide get methods for each field. The TestBloodData.java and TestPatient.java files have been provided to test your implementation of each class. Code is in java.
- Create a class named FootballTeam. Include two fields that hold data about theteams participating in the game. Also include a field for game time (for example, 5PM). Include a constructor that takes parameters for two FootballTeam objects anda time. From the main method, instantiate a FootballTeam object, then pass theGame to a method that displays the details about the FootballTeam."Create a class named Rock that acts as a superclass for rock samples collected and catalogued by a natural history museum. The Rock class contains fields for a number of samples, a description of the type of rock, and the weight of the rock in grams. Include a constructor that accepts parameters for the sample number and "weight. The Rock constructor sets the description value to Unclassified. Include get methods for each field. Create three child classes named IgneousRock, SedimentaryRock, and MetamorphicRock. The constructors for these classes require parameters for the sample number and weight. Search the Internet for a brief description of each rock type and assign it to the description field. Create an application that instantiates an object of each type and demonstrate that the methods work appropriately. Save the files as Rock.java, IgneousRock.java,SedimentaryRock.java, MetamorphicRock.java, and DemoRocks.java."Create a class named State that holds the following fields: a String for the name of the state, an integer forthe population, and two City objects that hold data about the capital city and the most populous city. TheState constructor requires six parameters that represent the names and populations of the state, its capital,and its most populous city. Provide get methods for each field. Create the City class to be a nonstatic, privateinner class within the State class; the City class contains a city’s name and population. Create a class to assign values to and display values from two State objects. Save the files as State.java and TestState.java.
- Which of the following statements are true? Group of answer choices 1. A superclass reimplements the functionality of its subclasses. 2. A class that implements an interface reuses the functionality of the interface. 3. A derived class reuses the functionality instead of reimplements it. 4. If a class has no bugs, we can inherit from it without fear of having any bugs in our class.The Rectangle class) Following the example of the Circle class in Section 9.2, design a class named Rectangle to represent a rectangle. The class contains: ■ Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. ■ A no-arg constructor that creates a default rectangle. ■ A constructor that creates a rectangle with the specified width and height. ■ A method named getArea() that returns the area of this rectangle. ■ A method named getPerimeter() that returns the perimeter.Draw the UML diagram for the class and then implement the class. Write a test program that creates two Rectangle objects—one with width 4 and height 40and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order.Create a class named “Rectangle” having length and width as attribute. There should be behaviorstoset the values of length and width (individually and collectively), and get their values individually. There should also bebehavior to display the perimeters and area of the rectangle. Create another class named as Main which hastwo objects of Rectangle (r1, r2) having length (3.2, 20) and width (4.5, 36) respectively. Also displaythe length, width, perimeter and area of both rectangles.