C++ Problem Specification: write a program using classes Use a class to implemen
ID: 3673533 • Letter: C
Question
C++
Problem Specification:
write a program using classes
Use a class to implement the solution of this problem:
You must include a null constructor, and destructor.
You must not use inline function, must declare functions in the class declaration section, and then implement them.
Input to the program consists of:
name
hours worked
hourly rate
This is an example of the output(name, hours and rate change, according to the data entered)
Employee Name: Jim Donavan
Hours worked: 40.00
Hourly Rate: $ 9.75
Total Wages: $ 390.00
Class Implementation
5 points class is defined correctly (data members, member functions).
5 points UML class diagram is handed-in and is correct.
5 points project has three files (specification, implementation, and client)
5 points constructor and destructor functions are defined and are null.
5 points main instantiate objects and calls public functions to do tasks.
5 points a member function reads the input data.
5 points a member function prints the information (all relevant data each on a separate line).
5 points test results are handed in.
10 points program designed as specified, runs and produces the correct results
Explanation / Answer
#include<iostream.h>
#include<conio.h>
class wages
{
public:
char name[20];
int hr_wk;
double rate;
wages()
{
}
~wages()
{
}
void cal()
{
cout<<"Employee Name:";
cin>>name;
cout<<"Hours worked: ";
cin>>hr_wk;
cout<<"Hourly Rate: ";
cin>>rate;
cout<<"Total Wages: $"<<
(hr_wk*rate);
getch();
}
};
void main()
{
wages o;
o.cal();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.