Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In order to answer #21, the first two photos are needed. Model III. (20 min) Designing a C++ Class start time: A simple class might

In order to answer #21, the first two photos are needed. image text in transcribed
image text in transcribed
image text in transcribed
Model III. (20 min) Designing a C++ Class start time: A simple class might have only one data field and a few methods that manipulate that data field. Data fields will be represented in the C++ class by a member/instance variable. By marking this instance variable private, we will have the opportunity to handle invalid values. By labeling this instance variable private, we will have the opportunity to handle invalid values. Create and save a new C++ class (Salary.cpp) with the following code: /** * Represents the salary for a person class Salary private: double annual; public: void setAnnualSalary(double salary) { annual = salary: 3 double getAnnualSalary() { return annual; } }; Instructions: Now add the following main method to the end of the Salary class file (outside of the class): int main() { Salary pay; pay.setAnnualSalary (64100); return 0; 3 Critical Thinking Questions 21. Consider invalid salary values for the Salary class. a. What would be an invalid salary value? 1 The average starting salary for a Computer Science major with a Bachelors degree was $64,100 in 2013. Computer Science graduates were the fourth highest paid majors in 2013, according to a Forbes study at http://www.forbes.com/sites/susanadams/2013/09/20/the-college-degrees-with-the highest starting-salaries/ CC O EYN SA 2018 by Helen Hu, hhu@westminstercollege.edu. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Class Design 2018-06 pg 8 of 10 b. What method would you use to attempt to set the annual salary to an invalid value? c. What does the Salary class currently do if you try to set the annual salary to an invalid value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

3. Describe the strategic training and development process.

Answered: 1 week ago

Question

10. Microsoft Corporation

Answered: 1 week ago