Create a class called ship that incorporates a ship’s serial number and location. Create another class angle which has two variables latitude and longitude. A member function of the ship class should get a position from the user and store it. Create object that should report the serial number and position. Write a main () program that creates three ships, asks the user to input the position of each, and then displays each ship’s serial number and position.Identify all the classes implement inheritance between them. (language cpp)
Q: Create a class called Quadratic for performing arithmetic on and solving quadratic equations. A…
A: # include<iostream> using namespace std; class quadratic { private: double a; double b;…
Q: Write a Program to define a Student class, with member variables o String name; o int cms o…
A: import java.util.*;class Student{ private String name; private int sms; private String…
Q: Write a program that declares two classes. The parent class is called Shape that has two data…
A: Algorithm: Create a shape class with variable num1 and num2. Create four functions setarea(),…
Q: Create a class named 'Member' having the following members using C++: Data members 1 - Name 2 - Age…
A: The instructions are provided using programming languages. Programming languages include C, C++, and…
Q: Create a class BankSyS which hold information regarding customer. customerAcct customeName…
A: Note: Program code designed based on procedure mentioned in the question. code:…
Q: Design a class named Person with properties for holding a person’s name, address, and telephone…
A: Program plan: · Design the page: o Add title to the form as “Person & Customer…
Q: Create a classstudent which includes parameters roll_no, name and address and consider as super…
A: //code import java.util.Scanner; class Student3 { void Student(int roll, String name,int…
Q: Given the following code for the base class Ship write another class that inherits from Ship called…
A: Below is the required code and sample output:
Q: A class Person is given below as your base class. Your task is to create a class Employee which will…
A: The solution to the given problem is below.
Q: Create a class named 'Member' having the following members: Data Attributes of Member Class 1- Name…
A: class Member: def Member_detail(self): self.__name = input("Enter Name: ") self.__age =…
Q: Using interfaces, you can specify similar behaviors for possibly disparate classes. Governments and…
A: It is defined as the programs can be asked from control statements, array, string, oops etc. Java…
Q: Consider the following class definition that represents an AM radio class Radio { public bool…
A: Given: Consider the following class definition that represents an AM radio class Radio { public…
Q: Create an abstract class called Employee that has an abstract method called calculatePay() which…
A: Note :- You have not mention the language of the program, So I am doing your question in Java. Your…
Q: Create another C++ class and call it Car. The Car class inherits form Vehicle class and has another…
A: #include <iostream>using namespace std; // to convert int to stringstring toString(int num){…
Q: Write a tester program to test the mobile class defined below. Create the class named with your id…
A: Create the class named with your id (for example: Id12345678) with the main method. Create two…
Q: Computer Science Exercise 1 (java)– Horses .Create a class Horse containing the attributes name,…
A: PROGRAM INTRODUCTION: Start the definition of horse class. Declare the required variables with…
Q: Develop the ‘Shape’ application such that: ‘Rectangle’, ‘Ellipse’, and ‘Triangle’ classes inherit…
A: Program plan:Define a class named “Shape”.Define a default constructor to print constructor invoked…
Q: (Implementing inheritance and apply the use of keyword super and this) Assume you have to develop a…
A: class GradedActivity{ int score; public int getScore() { return score; }…
Q: Q2. Write a class Bank that has the following data members –Account Holder name (ah_name[])…
A: Given: Q2. Write a class Bank that has the following data members –Account Holder name (ah_name[])…
Q: Write a java program to create a class named shape. In this class we have three sub classes sphere,…
A: Write a java program to create a class named shape. In this class we have three sub classes sphere,…
Q: Q1: Create class Year (year int, month int, day int as an instance variables) Create class Time…
A: Answer: Both above question are same I have done code for one another is analogous
Q: using c++ oop !!! kindly need help asap. Implement the shape, rectangle, and square classes with…
A: The question is to write c++ code for the given problem.
Q: Create a class named 'Member' having the following members: Data members 1 - Name 2 - Age…
A: Step 1: START Step 2: make Member class Step 3: Create data members Name, Age, Phone, Address,…
Q: Create a base class called Vehicle with name, max_speed, and tank_size attributes. Then create a…
A: The required Python code is given below: class Vehicle: name="" max_speed=0 tank_size=0…
Q: In the board game Scrabble, each tile contains a letter, which is used to spell words in rows and…
A: INTRODUCTION: Import the required libraries whose classes and methods are to be used in the program…
Q: There is an Admission class that assigns the admission id and registration number to the Student.…
A: The ask is to do the following: - create an Admission class that assigns the admission id and…
Q: Create a class Mammal and another class WingedAnimal. Make a class Bat that is derived from both the…
A: Create a class Mammal and another class Winged Animal. Make a class Bat that is derived from both…
Q: Develop the ‘Shape’ application such that: ‘Rectangle’, ‘Ellipse’, and ‘Triangle’ classes inherit…
A: Program plan:Define a class named “Shape”.Define a default constructor to print constructor invoked…
Q: Implement the following class MyPhoneBook. You can add additional private member variables and…
A: Answer : #include <iostream>#include <string.h> using namespace std; class PhoneBook{//…
Q: You are required to build a class JewelleryItem. A jewellery Item has a type (string) , price…
A: public class JewelleryItem{ //instance variables private String type; private float price; private…
Q: Suppose you are creating a system for bank accounts i.e. Current account and savings account. Create…
A: public class Client { String name; String address; String phone; BankAccount account; public…
Q: Implement the following class MyPhoneBook. You can add additional private member variables and…
A: Actually, program is an executable software that runs on a computer.
Q: Inheritance Create a class named Person and its two subclasses named Student and Employee. Then…
A: class Person{ protected String name, address, phoneNumber, emailAddress; //Constructor…
Q: There is an Admission class that assigns the admission id and registration number to the Student.…
A: Inheritance: In C#, inheritance is the mechanism by which one object inherits all of its parent…
Q: Create a "house" class that initializes house objects in the following way :…
A: """Program to create a class house, intialze it, get user monthly saving and display monthsneeded to…
Q: Write a Program in java to define a Student class, with member variables String name; int cms…
A: public class Student{ //creating specified data members private String name; private String…
Q: Create a Metal class that has at least one weight property. Write proper constructor and other…
A: Java code for above scenario :- class Metal{ public int wt; public Metal(int weight){…
Q: Write a class named Commission with the following features: O It extends the Hourly class. O It has…
A: Commission.java class is written below: public class Commission extends Hourly { //instance…
Q: Design a class named MyPoint to represent a point with xand y-coordinates. The class contains: a.…
A: MyPoint -x: int -y:int + MyPoint() + MyPoint(int x,int y)
Q: Create a base class called “Animal” which has two (2) class fields. The first field holds an integer…
A: class Animal{ int IDtag; String species; Animal(int IDtag,String species){ this.IDtag=IDtag;…
Q: Implement a BankAccount class. BankAccount must have the following members: A member variable…
A: Code: #include<iostream>#include<stdio.h>#include<string.h> using namespace std;…
Q: Build a class Sale with private member variables double itemCost; // Cost of the item double…
A: Constructor: Constructor is a special function that has the same class name. The class name and…
Q: Create a base class, cell phone and derive a class smartphone from it. In cell phone, create…
A: Abstract classes are parent classes or base classes. Abstract classes contain the common…
Q: Now you are going to make an accounts class. The class details are as follows: • There is a variable…
A: Introduction: Now you are going to make an accounts class. The class details are as follows:. There…
Q: Write a tester program to test the mobile class defined below. Create the class named with your id…
A: Given: Create the class named with your id with the main method. Create two mobiles M1 and M2 using…
Q: .Create a complete UML diagram which shows the relationships between the three classes, Account,…
A: Below is the solution
Q: Implement the following class MyPhoneBook. You can add additional private member variables and…
A: Coded using C++.
Create a class called ship that incorporates a ship’s serial number and location. Create another class angle which has two variables latitude and longitude. A member function of the ship class should get a position from the user and store it. Create object that should report the serial number and position. Write a main ()
(language cpp)
Step by step
Solved in 2 steps with 4 images
- Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.Using classes, design an online address book to keep track of the names, addresses, phone numbers, and dates of birth of family members, close friends, and certain business associates. Your program should be able to handle a maximum of 500 entries. Define a class addressType that can store a street address, city, state, and ZIP code. Use the appropriate functions to print and store the address. Also, use constructors to automatically initialize the member variables. Define a class extPersonType using the class personType (as defined in Example 10-10, Chapter 10), the class dateType (as designed in this chapters Programming Exercise 2), and the class addressType. Add a member variable to this class to classify the person as a family member, friend, or business associate. Also, add a member variable to store the phone number. Add (or override) the functions to print and store the appropriate information. Use constructors to automatically initialize the member variables. Define the class addressBookType using the previously defined classes. An object of the type addressBookType should be able to process a maximum of 500 entries. The program should perform the following operations: Load the data into the address book from a disk. Sort the address book by last name. Search for a person by last name. Print the address, phone number, and date of birth (if it exists) of a given person. Print the names of the people whose birthdays are in a given month. Print the names of all the people between two last names. Depending on the users request, print the names of all family members, friends, or business associates.Chapter 10 defined the class circleType to implement the basic properties of a circle. (Add the function print to this class to output the radius, area, and circumference of a circle.) Now every cylinder has a base and height, where the base is a circle. Design a class cylinderType that can capture the properties of a cylinder and perform the usual operations on the cylinder. Derive this class from the class circleType designed in Chapter 10. Some of the operations that can be performed on a cylinder are as follows: calculate and print the volume, calculate and print the surface area, set the height, set the radius of the base, and set the center of the base. Also, write a program to test various operations on a cylinder.
- Implement the Seller class as a derived class of Person class. Create the seller.h and seller.cppfiles for this class. The Seller class contains additional data members that hold a seller’s:o average star rating received from the buyers, ando total number of items sold.These data should be accessible by its derived classes. (should these data be private, public, orprotected?) The following methods are included in the seller class:• A default constructor and a copy constructor• A constructor that receives all of the data for a seller.(for the constructors, make sure to call the base class constructor as appropriate)• Appropriate get and set functions for the new data in this class• print() – overrides the base class print() to print the base class data and print all additionalseller data with appropriate messages. Make sure to call the base class print to print thebase class data.• read() – overrides the base class read() to read the base class data and reads all additionalseller data…Create a base class called “Animal” which has two (2) class fields. The first field holds an integer “IDtag” for a number that a zoo uses to catalogue their animals and the second field holds a string called “species.”From the Animal class, derive two (2) classes. One is called “Bird” and the other “Reptile”. E.g. Species could be (for the Bird class) ostrich, dove, chicken etc. and (for the Reptile class) lizard, snake, bearded dragon etc.The Bird class has an additional class field called “colour” which holds the colour of the birds feathers (int – 1=grey, 2=white, 3=black). The reptile class has an additional class field called “bloodTemp” which hold the reptile’s temperature of their blood (double).You need to instantiate two (2) objects. The bird object will be called “brd” and the reptile object called “rept.”Input values for the bird’s IDtag, species and feather colour (int) and for the reptile’s IDtag number, species and bloodTemp. Override the Animal class’s input and output…Given the following code for the base class Ship write another class that inherits from Ship called SpaceShip. Spaceship should have a field to store forwardLasers(an integer) and aftMineDispensers (another integer). You should provide a constructor that includes forwardLasers as an argument. You should have another constructor that includes both forwardLasers and aftMineDispensers as arguments. You should provide appropriate accessors and mutators. You should include a toString() method that prints out the forwardLasers and aftMineDispensers as well as the information from the super class toString(). Here is the code for the base class Ship. public class Ship { private String name; // Ship name private String yearBuilt; // Year it was built public Ship(String n, String y) { name = n; yearBuilt = y; } public void setName(String n) { name = n; } public void setYearBuilt(String y) { yearBuilt = y; } public String getName() { return…
- 1. Create a Student class that implements the Person interface. As well as storing the students name and email, also store their course grade (e.g A, B, C) in a member variable. The grade should be accessible via a getGrade method. For the implementation of getDescription return a message along the lines of “A C grade student”, substituting the students actual grade.2. Create a Lecturer class that implements the Person interface. This class should also store the subject that the lecturer teaches. Add a getSubject method, and implement getDescription so that it returns a suitable message, e.g. “Teaches Biology”.3. Create a third class, Employee that implements the interface. This should also store the name of the department the Employee works in (available via getDepartment). Again, getDescription should return a suitable message.In the board game Scrabble, each tile contains a letter, which is used to spell words in rows and columns, and a score, which is used to determine the value of words. The point of this exercise is to practice the mechanical part of creating a new class definition: Write a definition for a class named Tile that represents Scrabble tiles. The instance variables should be a character named "letter" and an integer named "value". Write a constructor that takes parameters named letter and value, and initializes the instance variables. Create getters for both of the attributes. (No setters, so that a Tile is immutable.) Implement the .toString() and .equals methods for a Tile. Your completed Tile class should work with this Main program (Links to an external site.) so that it produces sample output like shown at the end of the program. You can Fork the program to make your own version in Replit, where you can add your Tile.java, or you can copy the program to your own Java development…Create a class named 'Member' having the following members: Data members 1 - Name 2 - Age 3 - Phone number 4 - Address 5 - Salary It also has a method named 'printSalary' which prints the salary of the members. Two classes 'Employee' and 'Manager' inherits the 'Member' class. The 'Employee' and 'Manager' classes have data members 'specialization' and 'department' respectively. Now, assign name, age, phone number, address and salary to an employee and a manager by making an object of both of these classes and print the value you assigned.
- Step 3: Add a basic WineCase class and allow a buyer to select a case of wine to buy. Write a basic WineCase class to represent a case of wine. A WineCase object has four fields: refNo (a unique sequence of letters and digits), description (e.g. "chablis", "white burgundy" or similar), noOfBottles (in the case) and price (the price of the case in pounds). The constructor for the class should be passed suitable arguments to initialise these four fields. Add a selectWineCase() method to the Browser class which allows a browser to choose a case of wine provided that browser is a buyer. This method is passed a WineCase object as a parameter. You should declare a new field wineCase in the Browser class in order to store the case of wine selected. Make the selectWinecase() method print a message to the terminal window about the selection. An example is shown below: Buyer with ID 6732 has selected wine case with reference number LO786, a case of 2018 Pinot…Step 3: Add a basic WineCase class and allow a buyer to select a case of wine to buy. Write a basic WineCase class to represent a case of wine. A WineCase object has four fields: refNo (a unique sequence of letters and digits), description (e.g. "chablis", "white burgundy" or similar), noOfBottles (in the case) and price (the price of the case in pounds). The constructor for the class should be passed suitable arguments to initialise these four fields. Add a selectWineCase() method to the Browser class which allows a browser to choose a case of wine provided that browser is a buyer. This method is passed a WineCase object as a parameter. You should declare a new field wineCase in the Browser class in order to store the case of wine selected. Make the selectWinecase() method print a message to the terminal window about the selection. An example is shown below: Buyer with ID 6732 has selected wine case with reference number LO786, a case of 2018 Pinot…Create an abstract super class called Employee with the following attributes: Use JavaDoc comments in the Parent and Child Classes only but use @author for the driver name : String and the following methods getter and setter for the one attribute two constructors an abstract method called getPay() equals() toString() Create a sub class of Employee called SalaryEmployee with the following attribute yearlyPay : double and the following methods getter and setter for the one attribute two constructors getPay() that returns the yearlyPay divided by 52 equals() toString() Create a sub class of Employee called HourlyEmployee with the following attributes: hoursWorked : double payrate : double and the following methods getters and setters for the two attributes two constructors getPay() that returns the weekly pay (multiply hoursWorked by payrate - overtime included and 1.5 times payrate for hours > 40) equals() toString() Create a sub class of Employee called SalesEmployee with the…