0

Please help! The FIRST is the fractional positive number, salary; SECOND field is an integer, the number of days worked in a...

...month. Implement the AMOUNT () method-calculation the accrued amount for a given number of days for a given month: salary/day_month*days worked. Implement a class definition in any format. To demonstrate working with the new type of objects in all tasks, you need to write the main function. The program must include various ways of creating objects and arrays of objects are demonstrated. The program must demonstrate the use of all functions and methods. A pair structure is a structure with two fields that usually have the names first and second. You need to implement the data type using this structure. In task must be present: - init initialization method; the method must control the argument values on correctness; - keyboard input is read; - output to the display screen. Implement an external function named make_mun(), where mun is the type of implemented function structures. The function must get values for fields as arguments structures and return a structure of the required type.

25th Mar 2020, 2:43 PM
PUFFIN Channel
PUFFIN Channel - avatar
2 odpowiedzi
+ 4
Can you please show us your code? Thank you in advance
25th Mar 2020, 8:33 PM
CeePlusPlus
CeePlusPlus - avatar
0
I have a little experience because I'm not very good at object-oriented programming #include <iostream> #include <iomanip> #include <math.h> struct Job { double first; int second; void read(); void display(); void init(double salary, int days); double amount(); } void Job::init(double salary,int days) { first = salary; second = days; } void Job::display() { cout << "first: " << first << "\n second: " << second; } void Job::read() { cout << " first: "; cin >> first; cout << " second: "; cin >> second; } double Job::amount () { double a= first; int b= second; a=(a/30)*b; return a; } Job make_job(double a, int b) { Job c; c.first = a; c. second = b; return c; } using namespace std; int _tmain(int argc,_TCHAR* argv[]) { Job x,y; x.read(); x.display (); double a=x.amount(); cout << a; return 0; }
26th Mar 2020, 3:59 AM
PUFFIN Channel
PUFFIN Channel - avatar