Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1. A class called Book has been designed to represent books at a library. It contains:

Three private instance variables: title (of the type string), author (of the type string) and publish_year(of type integer).

Two overloaded constructors - a default constructor with no argument, and a constructor which takes three values, two strings and an integer for the data of the book.
Two public methods: getYear() and getTitle(), which return the publish_year and the title, respectively.
Do the following, you do not have to define the above class.
a. Declare two objects of Book and enter their respective data.
b. Calculate the age of the first book based on the published year.
c. Determine if the second book is published before the year 2015.


2. Employee
{ private:
int ID;
double salary;
public:
Employee (int id, double s)
{ ID = id; salary=s; }
double get_salary () { return salary;}
int get_ID() { return ID;}
};
Given the above class definition, write the main () function that will do the following :
a. Declare 2 Employee objects and insert their data based on the user input
b. Determine who has a larger salary between the 2 objects

What I have tried:

i need answer above 2 question,
i want answer oop at c++ please
Posted
Updated 2-Jun-18 8:00am

Sorry, we don't do your homework for you. If you have a specific question about something you've tried, ask and we'll try to help you.

/ravi
 
Share this answer
 
So, you show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
 
Share this answer
 
To solve your homework you need to learn in some C++ tutorial. After the basics is in higher chapters explained how to deal with user input and classes.

Your homework is simple to do, when you have learned the basics. So take the time ;-)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900