Demonstrate the classes in a program that has an array of Ship pointers. The array ele- ments should be initialized with the addresses of dynamically allocated Ship, CruiseShip, and CargoShip objects. (See Program 15-14, lines 17 through 22, for an example of how o do this.) The program should then step through the array, calling each object's print unction. ure et n DU class should
Q: In C++: 1) Write a printRange function which prints all values of an unsorted array (smallest to…
A: I have provided C++ CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: Write a function getMinMax() that, given an array of integers and two indexes, returns the minir and…
A: code is below:
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT| [[3],…
A: Algorithm - First, we will create one method with the name sortIt. Now use the below statement…
Q: ) Write a program to overload the function call operator ( ) so as to allow the more common form of…
A: Actually, array is an collection of elements.
Q: Write a template version of the iterative binary search algorithm from Display 13.8 which only…
A: Find the following code
Q: Carry out the following tasks with an array: Allocate an array of ten integers. Put the number 17…
A: Required: in C++ Carry out the following tasks with an array: Allocate an array of ten integers.…
Q: Implement a function void fill with values (int a[], int size, IntFunPointer f) hat sets the ith…
A: COde snippet and sample output:
Q: Write a function in c++ is ordered that takes an integer array and its size as parameters and…
A: Solution for the above question is solved in step 2 and step 3:-
Q: Write a program that it will get the size of dynamic array and create the dynamic array of structure…
A: C code :- #include <stdio.h>#include <stdlib.h>#include <string.h> // Create the…
Q: Write a C++ program to illustrate how to use the function copy and an ostream iterator in a program.…
A: The answer is in below steps:
Q: I wish to write a program to keep track of my coat hanger collection, I need a data structure for…
A: #include<iostream>using namespace std; struct Student { string hanger_type; int…
Q: In C++, Define a “Invalidanalyze” function that accepts an array
A: #include <iostream>#include <string>#include <vector> using namespace std; class…
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT| [[3],…
A: function sortIt(arr){ for(var i = 0; i < arr.length; i++){ // Last i elements are already in…
Q: In a kindergarten school, On Independence Day, 10 kids must stand in a line with number of roses in…
A: code: #include <stdio.h>int main(){int i,j,k;int arr[9];for(i=0; i<9; i++){ printf("enter…
Q: Consider an array declaration and initialization as, int arr[7]= {3,2,1,6,5,7,8};. A pointer 'ptr'…
A: Soln:- d)6 The value of the ptr[3]2+ptr[1] is 6
Q: 1) Write a C program that take students' GPA from a user and put them in the array and lculate the…
A: C program to find maximum, minimum GPA and its corresponding index in the array
Q: In OCaml, write a function printmat : bool array array -> unit = that given a bool matrix it prints…
A: Lets see the solution in the next steps
Q: Write a function SWAP (int ARR[ ], int Size) in C+ to modify the content of the array in such a way…
A: The Answer is
Q: Implement a range function for a dynamic array which returns a new dynamic array that is a subset of…
A: PROGRAM EXPLANATION Include the header file. Define the range function, this function will receive…
Q: Given the following class definition: class ptrMemberVarType public: void print () const; void…
A: The program is implemented in C++ with object oriented approach. All the functions have already been…
Q: Write an OOP complete program in class Overloading constructor, destructor and pointers by using…
A: The Answer is in given below steps
Q: An array with any number of elements is said to be repeating if any two or more of the elements are…
A: logic:- compare each element with their neighbouring elements , if they are equal immediately…
Q: Write a program to overload the function call operator ( ) so as to allow the more common form of…
A: Actually, program is executable software that runs on a computer.
Q: Given an Array M of 99 int values, and int *pit: 1. Declare two pointers pl and p2 2. Make p1 point…
A: NOTE: According to the guidelines, attempt only the first 3 subparts. First, we will create the…
Q: Marked Problems. Complete an implementation for the following prototype of a function that searches…
A: Coded using C language.
Q: Solution In JAVA Create a function that takes two numbers as arguments (num, length) and returns an…
A: In this problem, we need to solve the problem in the JAVA programing language. Algorithm - Take…
Q: Define a new “findLatestDegreesBySubject” function that accepts 3 parameters: o An array of “Degree”…
A: Creating class Degree having only one attribute called as subject of type and constructor to set the…
Q: Write a function called "AddRows" that accepts two parameters: W1: a matrix of size 7x4 elements of…
A: Code: #include<stdio.h>main(){ int m[7][4]; int a[4]; int i,j,k; for(i=0;i<7;i++) {…
Q: Write a C++ program to declare an array A={3, -7, 12, -4, 5, -2} and pass it to a void-type function…
A: C++ Function to find max, min and average of the array values given.
Q: Write a Program for insertion and deletion from an array without replacement of element from the…
A: Program Approach: Complete the function of insertion by inserting the element at the given…
Q: Write a template function that returns the third minimum out of all the element of an array. The…
A: Algorithm: Start Define a template function to return the third minimum element of an array Let the…
Q: define and initialize and array X of length 8. You need implement following and write outcomes with…
A: Given: int X[]={1, 2, 3, 4, 5, 6, 7, 8}; ⇒X[0]=1, X[1]=2, X[2]=3, X[3]=4, X[4]=5, X[5]=6, X[6]=7…
Q: Write a C++ program for the following Implement the Tic-Tac-Toe game in C++ using functions and 2D…
A: #include <iostream>using namespace std;char square[10] =…
Q: Write a modular program in C++ that analyzes a year’s worth of rainfall data. In addition to main,…
A: Program: #include <iostream> #include <string> #include <iomanip> using…
Q: pls give mommens by expression and statements , thanks Recall that in C++, there is no check on an…
A: Actually, array is a collection of elements.
Q: Write a code in C++ and create a two dimensional Array of size 5 X 5. (1) Inserting the following…
A: 1. Create a dynamic 2D array with size 5x5. 2. Store the numbers to be inserted into the 1D array.…
Q: Profile the performance of the memoized version of the Fibonacci function defined in Project 6. The…
A: Define the Counter class, it should have three methods: __init__, increment, and __str__. When an…
Q: Implement a main program that defines a dynamically created array, consisting of objects of class…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: Write a program that will sort a prmiitive array of data using the following guidelines - DO NOT USE…
A: CODE: Currency.java // abstract base classpublic abstract class Currency { protected int…
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT [[3], 4,…
A: In the given problem you need to create a JavaScript program to sort an array containing either…
Q: Let's play a game from which you are not yet familiar so quickly I will introduce you with the rule.…
A: Input-Output Details The first line of input contains a single integer TT, denoting the number of…
Q: Write a program that allows two players to play the tick-tac-toe game. Your program must contain the…
A: Write a program that allows two players to play the tick-tac-toe game. Your program must contain the…
Q: In this challenge you will be given an array similar to the following: Solve in JAVA SCRIPT| [[3],…
A: In this problem, we need to create the JS code and create a method for the sorting. Input - Array…
Q: Answer the following based on the photo: How many pointer variables are there? How many operations…
A: The solution to the given problem is below.
Q: Write a modular program that analyzes a year’s worth of rainfall data. In addition to main, the…
A: Given: Write a modular program that analyzes a year’s worth of rainfall data. In addition to main,…
Q: Write a program to implement binary search algorithm on a dynamic array of objects of “patient”…
A: The ask is to write a program to implement the following: - Construct a Patient class - Add Patients…
Please help me C++ language
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 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.In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extclockType from the class clockType by adding a member variable to store the time zone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write a test program to test your class.Breed Class Create a Breed class with the following: Member Variables Create the following private member variables, all of type std::string: species_ breed_name_ color_ Constructors Create a default constructor for Breed that sets its species_ to "Dog", breed_name_ to "Pug", and color_ to "Fawn". Create a non-default constructor that receives a std::string for species_, breed_name_, and color_; in that order. The values from the constructor should appropriately assign the member variables. Accessors and Mutators Create accessors and mutators for all member variables, following the naming conventions covered in class. e.g. for species_, name the accessor Species, and the mutator SetSpecies. Pet Class Create a Pet class with the following: Member Variables Create the following private member variables: std::string name_ Breed breed_ double weight_ Constructors Create a default constructor for Pet that sets its name to "Doug" and weight to 15.6. The Breed object will…
- Pets Breed Class Create a Breed class with the following: Member Variables Create the following private member variables, all of type std::string: species_ breed_name_ color_ Constructors Create a default constructor for Breed that sets its species_ to "Dog", breed_name_ to "Pug", and color_ to "Fawn". Create a non-default constructor that receives a std::string for species_, breed_name_, and color_; in that order. The values from the constructor should appropriately assign the member variables. Accessors and Mutators Create accessors and mutators for all member variables, following the naming conventions covered in class. e.g. for species_, name the accessor Species, and the mutator SetSpecies. Pet Class Create a Pet class with the following: Member Variables Create the following private member variables: std::string name_ Breed breed_ double weight_ Constructors Create a default constructor for Pet that sets its name to "Doug" and weight to 15.6. The Breed object will…you will design various classes and write a program to computerize the billing system of a hospital.a. Define a class personType having members of id, name, cnic. Define overloaded constructor,getter/setters and destructor.b. Design the class doctorType, inherited from the class personType, with an additional data member to store a doctor’s speciality. Add appropriate constructors and member functions to initialize, access, and manipulate the data members.c. Design the class billType with data members to store a patient’s ID and a patient’s hospital charges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate constructors and member functions to initialize and access and manipulate the data members.d. Design the class patientType, inherited from the class personType, with additional data members to store a patient’s ID, age, date of birth, attending physician’s name, the date when the patient was admitted in the hospital, and the date when the patient…# Pets## Breed ClassCreate a `Breed` class with the following: ### Member VariablesCreate the following private member variables, all of type `std::string`: 1. `species_`2. `breed_name_`3. `color_` ### Constructors1. Create a default constructor for `Breed` that sets its `species_` to `"Dog"`, `breed_name_` to `"Chihuahua"`, and `color_` to `"Fawn"`.2. Create a non-default constructor that receives a `std::string` for `species_`, `breed_name_`, and `color_`; in that order. The values from the constructor should appropriately assign the member variables. ### Accessors and MutatorsCreate accessors and mutators for all member variables, following the naming conventions covered in class. e.g. for species_, name the accessor `Species`, and the mutator `SetSpecies`. ## Pet ClassCreate a `Pet` class with the following: ### Member VariablesCreate the following private member variables:1. `std::string name_`2. `Breed breed_` 3. `double weight_` ### Constructors1. Create a default constructor…
- Create a class named ElectricCar and display its model, color, mpg and condition. Note that ElectricCar is a class which inherits from its parent class named Car. In the parent class Car, it has a global variable named condition and its condition is set to ”new” at all time, and has three variables in the constructor ”model, color and mpg”. Furthermore, in the parent class Car, it contains two functions a display car function that displays the car attributes (such as model, color and mpg) and a drive car function that changes the condition to ”used”. Moreover, in the child ElectricCar class, it has one more attribute ”battery type” and it overrides the drive car function by setting the condition to ”like new”. To test your class CreateaElectricCarnamedmyCarbysettingmodel=”DeLorean”,color=”silver”, mpg=88, and battery type=”molten salt”. Display myCar’s condition by ”print(myCar.condition)”. Output is ”new”. Change myCar’s condition to ”like new” by myCar.drive car(). Again,…Create a class named Laboratory containing• Two data fields i.e. name (a string) and location (string)• A no-argument constructor to initialize all data fields with default values “NoName” and “NULL”• A member function named input()• A member function named show() to display the details associated with an instance of this classDerive a class named WetLab from class Laboratory that includes• data members no_of_microscopes and Scientist_name,• respective mutator and accessor functions • overriding function named input() to take input from user in all data members• overriding function named show() to display the details associated with an instance of class WetLabFrom the Laboratory class, derive a class named DryLab that contains• a data field named no_of_computers and Capacity • Setters and getters• an overriding function named input()• overriding function named show() to display the details associated with an instance of this class Implement these classes and in the main() create…In this exercise, you will design the class memberType. Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent. Include the member functions to perform the various operations on the objects of memberType—for example, modify, set, and show a person’s name. Similarly, up-date, modify, and show the number of books bought and the amount spent. Add the appropriate constructors. Write the definitions of the member functions of memberType. Write a program to test various operations of your class memberType.
- Create a class called students with 4 private member variables, name quiz midterm and final term include all necessary member function with constructor, get function and grading function declare 3 object of students type read from the keyboard three sets of values of name quiz midterm and final and assign them to each object using objects member function to calculate grade =quiz *0.2 +midterm *0.4+final*0.4 display on the screen only name and gradeWrite a class Person that has attributes of id, name and address. It has a constructor to initialize, a member function to input and a member function to display data members. Create another class Student that inherits Person class. It has additional attributes of rollnumber and marks. It also has member function to input and display its data members. Write a simple C++ code as I am a beginner.Representing a point in the plane, a class named PlanePoint has • Two data members i.e. X and Y (correspond to x and y coordinates) of integer type, • Two accessor functions named as getX() and getY() to get values of data members X and Y• A function named planeDistance() that calculates and returns the distance between two points in a planeDerive a class named SpacePoint to imagine a point in a three-dimensional space and has following additional features:• A data member Z of type integer to represent the z-coordinate of a point in space• A no-argument constructor that constructs a point with coordinates (0,0,0)• A constructor with three arguments that constructs a point with three specified coordinate values• An accessor function, which returns the value of data field Z• A function named spaceDistance to return the distance between two points in the spaceImplement both the classes and in the main() create two points with different dimensions and invoke appropriate function to display…