Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Question 1:

This question is based on contents covered in Chapter 10 of text. The objectives of the questions are to:

• access if students have understood the basic concepts of object-oriented class
• write the class specification, constructor, accessors and mutators
• write test driver to test the written methods

Examine the following class diagram, additional information and answer the questions that follow:

CarSpeed

acceleration: float engine_number: string start: bool
CarSpeed(float = 0, string = "", bool = false) start_car():void
stop_car():void set_acceleration(float): void set_engine_number(string): void get_velocity(float): float

(a) List FOUR characteristics of a constructor.

(b) Develop C++ code to implement the CarSpeed specification.

(c) Develop C+ code to implement ALL methods found in the CarSpeed class.

(d) Inspect the sample output and write a test driver to test and fulfil at least the following requirements.

Uses a loop that repeats 3 times to prompt the user to enter the engine number, acceleration and time, use the various mutators to set the engine number, acceleration & time, invokes the respective method to display the velocity. The velocity is displayed with 2 decimal places.

Question 2

This question is based on contents covered in Chapter 10 and 11 of text. The objectives of the questions are to:
• Implement the constructor, assessors, mutators and methods
• understand object composition
• write test driver to test the written methods

You are required to write the declaration and implementation code in separate files. Your submission is expected to reflect this.

Examine the following class specifications, additional information and answer the questions that follow:

class Date
{
int dd; int mm; int yy;
public:
Date(int = 1, int=1, int=2015); void setDate(int, int, int); int getDD();
int getMM(); int getYY();
};
class Appointment
{
private:
string NRIC; string name; double fees; Date visit; Date nextVisit;
public:
Appointment();
void setAppt(string, string, double, Date, Date); Date getVisit();
Date getnextVisit(); string getName(); void displayAppt();
void displayAppt(name);
};

(a) Define function overloading. Identify the overloaded function(s) found in the given class(es).

(b) Develop C++ code to implement ALL the methods found in the above class specifications

(i) Date Class

(ii) Appointment Class

(c) Write a test driver to test ALL the methods in the Date and Appointment classes. The test driver should at least include the following:
(i) declare an array of 4 Appointment
(ii) initialised the array of Appointment objects with the data from the following test data
(iii) display all appointment objects, using displayAppt method
(iv) display a single appointment object, using displayAppt(string) method, passing in the NRIC value, "S56783".

Include a screen output similar to the sample output in your submission.

Question 3

This question is based on contents covered in Chapter 6 of text. The objectives of the question are to:

(a) implement the methods as per given class requirements
(b) write the test driver to test the given methods
(c) write file processing code

Examine the given class specification, data files, additional information and answer the questions that follows:

class Format
{
private:
int number; public:
void writeFile();
};

(a) Define ifstream and ofstream.

(b) Using C++ code, develop the writeFile method, fulfilling the requirement stated in the

Additional Information above.

(c) Write a test driver to test the following:
• instantiate one instance of Format,
• invokes the writeFile method

Question 4

This question is based on contents covered in Chapter 10 and 15 of text. The objectives of the question are to:

(a) assess students' understanding of the basic concept of inheritance in C++.

(b) write code demonstrating their understanding of inheritance.

(c) assess if students have understood the basic concept of dynamic binding.

Study the given class diagrams, additional information and answer questions that follow:

Pledge
amt1: float
Pledge(); Pledge(float = 1.00);
virtual add_pledge(float): void virtual get_pledge():float; virtual display():void

SpecialPledge
*amt2: float
SpecialPledge(float); add_pledge(float): void get_pledge():float display():void

(a) Using C++ code, construct the class specification for
(i) Base class: Pledge

(ii) Derived class: SpecialPledge

(b) Write C++ code to implement the constructor and methods found in
(i) Pledge

(ii) SpecialPledge

(c) Write a test driver to fulfil at least the following requirements:

• Declare a vector array of 2 Pledge objects
• Use the new operator to instantiate two objects:
(i) one Pledge object with the value 200
(ii) one SpecialPledge object with the value 50

• Invoke ALL the methods
• See sample output (bold and highlighted) to see the testing of ALL methods.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91580541
  • Price:- $150

Guranteed 48 Hours Delivery, In Price:- $150

Have any Question?


Related Questions in C/C++

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As