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
- Assignment:The BankAccount class models an account of a customer. A BankAccount has the followinginstance variables: A unique account id sequentially assigned when the Bank Account is created. A balance which represents the amount of money in the account A date created which is the date on which the account is created.The following methods are defined in the BankAccount class: Withdraw – subtract money from the balance Deposit – add money to the balance Inquiry on:o Balanceo Account ido Date createdCreate an Account class that a bank might use to represent customers’ bank accounts. Include a data member to represent the account balance. Provide a constructor that receives an initial balance and uses it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0. If not, set the balance to 0. Provide three member functions:- credit($amount) should add amount to the current balance- debit($amount) should ensure that amount does not exceed the current balance and then reduce the current balance by amount. The balance should not change if amount exceeds the balance.- getBalance() should return the current balanceNote: Create a set of test data and then write a program to test the class.Question 6 Create a set of classes and interface for the following scenario: Define an interface called Classical Music, which contains a get Year method that returns the year the classical album released. Create an abstract class Called CD. This class contains the title as String, and playingTime as integer (e.g. 60 minutes). Include a constructor to initialize all the data fields. Create an abstract method called printPlayingTime to show the CD playing details. Make sure all the data fields can be accessed directly from the child classes. Create a class called Album that inherits from the CD and Classical Music. Include a data field called year as integer type. Create a constructor to initialize all the data members. Override the getYear method to return the released year. Override the printPlayingTime method. If the CD title is more than 10 characters, this method will print the first 10 characters, followed by the three ellipse dots and the playing time. For example: Thriller 60…
- A SuperDie Class Write a class SuperDie that models a single die with an arbitrary number of sides, not just six. A die instantiated with the default constructor has six sides. The methods of this class should be: • roll a die and return its value, • return the number of sides on a die, and • change the number of sides on a die. Include a main(...) method that tests all the methods of your class.Object Oriented Programming in JAVA You are part of a team writing classes for the different game objects in a video game. You need to write classes for the two human objects warrior and politician. A warrior has the attributes name (of type String) and speed (of type int). Speed is a measure of how fast the warrior can run and fight. A politician has the attributes name (of type String) and diplomacy (of type int). Diplomacy is the ability to outwit an adversary without using force. From this description identify a superclass as well as two subclasses. Each of these three classes need to have a default constructor, a constructor with parameters for all the instance variables in that class (as well as any instance variables inherited from a superclass) accessor (get) and mutator (set) methods for all instance variables and a toString method. The toString method needs to return a string representation of the object. Also write a main method for each class in which that class is…java programming language You are part of a team writing classes for the different game objects in a video game. You need to write classes for the two human objects warrior and politician. A warrior has the attributes name (of type String) and speed (of type int). Speed is a measure of how fast the warrior can run and fight. A politician has the attributes name (of type String) and diplomacy (of type int). Diplomacy is the ability to outwit an adversary without using force. From this description identify a superclass as well as two subclasses. Each of these three classes need to have a default constructor, a constructor with parameters for all the instance variables in that class (as well as any instance variables inherited from a superclass) accessor (get) and mutator (set) methods for all instance variables and a toString method. The toString method needs to return a string representation of the object. Also write a main method for each class in which that class is tested – create…
- Java Language You need to develop a system in Java for a Juice company. Create a class Juice with data member’s sugar, flavour, size, amount of water, and price. Write required Constructors (no argument and parameterize) for this class. Write a member method showJuice() to display the contents of a juice object though you may have to write some more methods as per need. In main() method you need to create different juices with the following specifications: 1) Sugar = 5g, flavor = mango, size = ½ (half liter), water = ½ liters, price = $1 2) Sugar = 2g, flavor = orange, size = ½ (half liter), water = ½ liters, price = $2 3) Sugar = 3g, flavor = graps, size = ½ (half liter), water = ½ liters, price = $3 You also need to create 1 litter juices for the company by adding objects of two half litter juices. While adding two half litter flavours to make a 1 litter juice, make sure you can only add same flavour juices. If two objects of different…In 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.Construct a Time class containing integer data members seconds, minutes, and hours. Have the class contain two constructors: The first should be a default constructor having the prototype Time(int, int, int), which uses default values of 0 for each data member. The second constructor should accept a long integer representing a total number of seconds and disassemble the long integer into hours, minutes, and seconds. The final member method should display the class data members.
- Please code in python Create a program with two classes – the person class and the student The person class has the following properties: first name (first_name), last name (last_name) street address (address) city (city) zip code (zip) The class has the following methods: get_full_name, which returns the full name of a person get_full_address, which return greeting, returns a greeting message. The class should provide accessor and mutator for each property The class should override the __str__ method to return the state of the object. Create a child class called student which has a property named graduation year (graduation_year) and major. Provide accessor and mutator for each property of its own It inherits all the properties and methods of the person parent class as well. Create a test program that Create an object of the person class and print the full name of a person. Create an object of the person class and print…Code the StudentAccount class according to the class diagramMethods explanation:pay(double): doubleThis method is called when a student pays an amount towards outstanding fees. The balance isreduced by the amount received. The updated balance is returned by the method.addFees(double): doubleThis method is called to increase the balance by the amount received as a parameter. The updatedbalance is returned by the method.refund(): voidThis method is called when any monies owned to the student is paid out. This method can onlyrefund a student if the balance is negative. It displays the amount to be refunded and set thebalance to zero. (Use Math.abs(double) in your output message). If there is no refund, display anappropriate message.Test your StudentAccount class by creating objects and calling the methods addFees(), pay() andrefund(). Use toString() to display the object’s data after each method calledInheritance and UML (Java) Design a class named Employee. The class keeps the following information in fields: - Employee Name - Employee Number in the format XXX-L, where each X is a digit within the range 0-9 and the L is a letter within the range A-M. - Hire Date - Shift (an integer) - Hourly pay rate (a double) Write one or more constructors and the appropriate accessor and mutator methods for the class. The workday is divided into two shifts: day and night. The shift field will be an integer value representing the shift that the employee works. The day shift is shift1 and the night shift is shift 2. a) Draw a UML diagram of the class. Be sure to include notation showing each field and method’s access specification and data type. Also include notation showing any method parameters and their data types. b) Write a program that demonstrates the class.