一本名为book的课程被设计用来代表图书馆的书籍。它包含: [英] 1. A class called book has been designed to represent books at a library. It contains:

查看:108
本文介绍了一本名为book的课程被设计用来代表图书馆的书籍。它包含:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。一个名为Book的课程被设计用来代表图书馆的书籍。它包含:



三个私有实例变量:title(类型字符串),author(类型字符串)和publish_year(类型为整数)。



两个重载的构造函数 - 一个没有参数的默认构造函数,以及一个构造函数,它接受三个值,两个字符串和一个整数用于本书的数据。

两个公共方法:getYear()和getTitle(),它们分别返回publish_year和title。

执行以下操作,您不必定义上述类。

a。声明Book的两个对象并输入各自的数据。

b。根据公布的年份计算第一本书的年龄。

c。确定第二本书是否在2015年之前出版。





2.员工

{私人:

int ID;

双倍薪水;

公开:

员工(int id,double s)

{ID = id;薪水= S; }

double get_salary(){return salary;}

int get_ID(){return ID;}

};

给定上面的类定义,编写将执行以下操作的main()函数:

a。声明2个Employee对象并根据用户输入插入数据

b。确定谁在两个对象之间有更高的薪水



我尝试过:



i需要回答2以上的问题,

i想在c ++上回答oop请

解决方案

对不起,我们不做你的功课为了你。如果您对尝试过的事情有特定的疑问,请询问,我们会尽力帮助您。



/ ravi


< blockquote>所以,你没有尝试自己解决问题,你毫无疑问,你只是想让我们做你的HomeWork。

HomeWork问题是你将遇到的问题的简化版本在现实生活中解决,目的正在学习和练习



我们不做你的家庭作业。< br $>
HomeWork不会在乞求其他人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解以及问题你应用它们。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


要解决您的功课,您需要学习一些 C++教程。在更高章节的基础知识之后,解释了如何处理用户输入和课程。



当您学习了基础知识后,您的作业很简单。所以请花点时间; - )


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

解决方案

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


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.


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 ;-)


这篇关于一本名为book的课程被设计用来代表图书馆的书籍。它包含:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆