Explore BrainMass
Share

# 3 C++ Programs !

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

L. Create a program to determine the smallest number out of 15 numbers entered (numbers entered one at a time from the keyboard). This should be done in prototype:
double smaller (double x, double y);
Make sure you use a for loop expression inside your function. Be sure to include your program prompts for input and a display of the smallest number when you have found it.

2. You are a mortgage broker who is determining whether you should provide a mortgage to
perspective home purchasers. If you are willing to provide a mortgage, you need to
decide how much you should charge the borrower. You design a point system that
assigns perspective borrowers a score of 1,2,3,4, or 5 based on some mysterious
formula. Based on these scores, you come up with the following decisions:
Score Decision
5 Provide mortgage at 5% interest rate
4 Provide mortgage at 6% interest rate
3 Provide mortgage at 7% interest rate
2 Do not provide mortgage
1 Do not provide mortgage

Create a program that takes the scores as input and provides as output the management
decision. In the program, include 2 void functions titled getScore and printdecision,
each with an int argument.

? The function getScore should have a Reference parameter that gets the score in
getScore and then passes the value back to be printed in main (), and
? print Decision should have a Value parameter.

The function getScore will prompt the user for the integer score from 1 to 5, get the input
from the user, and display the input received on the screen. The function printDecision
will determine the mortgage decision and print the decision. (Be careful and note that
this problem requires you to input the score into getScore and not directly into the main
function.)

3. Define a class called Date that has 3private members that represent the month, day, and year respectively. They will be represented as integers. Include a constructor and a public void function called print that prints out the date. (For example, if the month is 2, the day is 25, and the year is 1946, print provides as output 2/25/1946.) Include the class in a program that prints out the date 2/25/1946.