Ask a question from expert

Ask now

C++ Programs for Vehicle Warranty, Person and Subclasses

3 Pages781 Words323 Views
   

Added on  2019-09-18

About This Document

This article provides step-by-step instructions and sample code for creating C++ programs for Vehicle Warranty, Person and Subclasses. The Vehicle Warranty program creates a class with variables and functions to calculate the validity of a warranty. The Person program creates a class with variables and functions to display information about a person. The Subclasses program modifies the Person class and creates two subclasses, Student and Staff, with their own variables and functions.

C++ Programs for Vehicle Warranty, Person and Subclasses

   Added on 2019-09-18

BookmarkShareRelated Documents
1.Create a C++ program:Create a vehicle warranty class:oAdd the following variables (make all variables private):Vehicle MakeVehicle ModelYear manufacturedLength of warrantyoAdd the following constant (make it private):Current yearoInclude the following functions (do not take any user input in the functions. Pass all needed values in as parameters):Public set (mutator) functions for all variables (not the constant)Public get (accessor) functions for all variables (including the constant)Public function used to calculate the warranty validity. Use this formula:Year manufactured + length of warranty - Current YearIf the result is negative the warranty is not valid. Otherwise it is valid.This function will return a boolean value (0 or 1) indicating if the warranty is valid. If it is valid return 1. If not then return 0.In the main function:oCreate an object using the vehicle warranty class as the type.oGather user input and pass to the object:MakeModelYear manufacturedLength of warrantyoCall the function to calculate if the warranty is valid.oDisplay all information the user entered, plus the current year (use the get functions).oDisplay if the warranty is valid or not.oInclude appropriate output messages.oRepeat until the user chooses to quit.Compile and run your code.Submit your source code as a plain text file with a .cpp extension. Make sure it compiles without error before submitting it.2.
C++ Programs for Vehicle Warranty, Person and Subclasses_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Functions Accessible to Classes and Programs
|2
|497
|197

Principles of Programming
|4
|546
|118

C++ Programming Tasks for Desklib Online Library
|20
|976
|199

CS 260 Homework 5: Payroll with SortedList and Validation
|2
|587
|184

Graphical User Interface: Assignment
|6
|2354
|494

“Number” represents each element with array
|6
|800
|17