Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create a class called changeValue that declares 2 integer class variables: value1 and value2. These should be declared as public and you should not

1. Create a class called changeValue that declares 2 integer class variables: value1 and value2. These should be declared as public and you should not use automatic properties to declare them.

2. Your class should have a constructor that initializes the two class variables.

3. In the class provide a method printit() that displays the result of multiplying value1 and value2.

4. In the default wrapper class named assignment3 and containing Main write the code in Main that declares two integer variables: val1 and val2.

5. Use Console Write and Readline and the convert method to take the two integer entries from the keyboard and pass them to the changeValue constructor.

6. Instantiate a changeValue object and pass the two integer values to the constructor.

7. In the changeValue constructor evaluate the two input values that were passed using if statements: if val1 is greater than 5 then set class variable value1 equal to the first value passed to the constructor. if val1 is less than or equal to 5 then set class variable value1 equal to the first passed value plus the second passed value. if val2 is less than 10 then set class variable value2 equal to the second passed value times the second passed value and then add 5. if val2 is greater to or equal to 10 then set class variable value2 equal to the second passed value.

8. From Main call the printit method which will print the resulting computed values in the class object. The output might look like this: Enter an integer value: 8 Enter a second integer value: 3 The calculated value is: 112 Press any key to continue . . .

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions