本文介绍了一本名为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请解决方案 所以,你没有尝试自己解决问题,你毫无疑问,你只是想让我们做你的HomeWork。 HomeWork问题是你将遇到的问题的简化版本在现实生活中解决,目的正在学习和练习。 我们不做你的家庭作业。 HomeWork不会在乞求其他人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解以及问题你应用它们。 你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。 你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。 所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。 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 inputb. Determine who has a larger salary between the 2 objectsWhat I have tried:i need answer above 2 question,i want answer oop at c++ please 解决方案 这篇关于一本名为book的课程被设计用来代表图书馆的书籍。它包含:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 18:55