Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help to answer all. Please use LOOP in your code. Please also include detailed comments in your code to make it easy to understand.

Please help to answer all. Please use LOOP in your code. Please also include detailed comments in your code to make it easy to understand. Thank you very much.

Question 2: Write a C++ program (using LOOP only) that asks for a certain amount of numbers to process n, then reads successively these n numbers and displays the smallest number among these same numbers

Example 1:

How many numbers do you want to process? : 4 Enter the number 1: 12 Enter the number 2: 140 Enter the number 3: -2 Enter the number 4: 22 The smallest of these numbers is: -2

Example 2:

How many numbers do you want to process? : 3 Enter the number 1: 12 Enter the number 2: 12 Enter the number 3: 55 The smallest of these numbers is: 12

Question 3: (Please use LOOP only) The UBANK bank grants a loan only if the total amount of interest it can collect is greater than $30,000 and the term of the loan is less than or equal to 20 years. To answer to this strict policy, you must write a C++ program (use LOOP only) that takes as input the sum you want to borrow and the bank's annual interest rate. The program must then calculate the number of years necessary for the accumulated interest that the bank can collect exceeds $30,000. In case the number of years exceeds 20 years, the loan is denied.

The program must display the number of years required as well as the details of the accrued interest and the total amount the borrower will have to repay to the bank (see examples). It is clear that each year, the interest is calculated on the new amount. So for a loan of 120,000 dollars at 7%, we will have:

First year: interest=12000*0.07=8400

Second year interest=(128400)*0.07=8988

Second year interest=(137388)*0.07=9617.16

Etc

Example 1:

Enter the amount that you want to borrow: 120000

Enter the annual interest rate: 7

Year 1: annual interest = 8400.00: accrued interest = 8400.00, total amount to repay = 128400.00

Year 2: annual interest = 8988.00: accrued interest = 17388.00, total amount to repay = 137388.00

Year 3: annual interest = 9617.16: accrued interest = 27005.16, total amount to repay = 147005.16

Year 4: annual interest = 10290.36: accrued interest = 37295.52, total amount to repay = 157295.52

The loan is accepted. The interest accrued over 4 years will be 37295.52 dollars.

Example 2:

Enter the amount that you want to borrow: 30000

Enter the annual interest rate: 2

Year 1: annual interest = 600.00: accrued interest = 600.00, total amount to repay = 30600.00

Year 2: annual interest = 612.00: accrued interest = 1212.00, total amount to repay = 31212.00

Year 3: annual interest = 624.24: accrued interest = 1836.24, total amount to repay = 31836.24

Year 4: annual interest = 636.72: accrued interest = 2472.96, total amount to repay = 32472.96

Year 5: annual interest = 649.46: accrued interest = 3122.42, total amount to repay = 33122.42

Year 6: annual interest = 662.45: accrued interest = 3784.87, total amount to repay = 33784.87

Year 7: annual interest = 675.70: accrued interest = 4460.57, total amount to repay = 34460.57

Year 8: annual interest = 689.21: accrued interest = 5149.78, total amount to repay = 35149.78

Year 9: annual interest = 703.00: accrued interest = 5852.78, total amount to repay = 35852.78

Year 10: annual interest = 717.06: accrued interest = 6569.83, total amount to repay = 36569.83

Year 11: annual interest = 731.40: accrued interest = 7301.23, total amount to repay = 37301.23

Year 12: annual interest = 746.02: accrued interest = 8047.25, total amount to repay = 38047.25

Year 13: annual interest = 760.95: accrued interest = 8808.20, total amount to repay = 38808.20

Year 14: annual interest = 776.16: accrued interest = 9584.36, total amount to repay = 39584.36

Year 15: annual interest = 791.69: accrued interest = 10376.05, total amount to repay = 40376.05

Year 16: annual interest = 807.52: accrued interest = 11183.57, total amount to repay = 41183.57

Year 17: annual interest = 823.67: accrued interest = 12007.24, total amount to repay = 42007.24

Year 18: annual interest = 840.14: accrued interest = 12847.39, total amount to repay = 42847.39

Year 19: annual interest = 856.95: accrued interest = 13704.34, total amount to repay = 43704.34

Year 20: annual interest = 874.09: accrued interest = 14578.42, total amount to repay = 44578.42

Loan is denied. The interest rate accrued over 20 years is 14578.42 dollars

Question 4: (Please use LOOP only) When a user wants to access one of the university's servers, he must identify himself using a username and password. These data must be validated and only once both data entered. Write the C++ program (use loop only) that reads the code and the password. The program then validates the data as follows:

- The program displays Welcome, you have access to the network, if the user enters UQAM as user code and Z425_H23 as password. The code is not case sensitive, however the password is case sensitive.

- Si lutilisateur n'entre pas le code et le mot de passe attendus, deux messages sont afficher :

 - A first message to be displayed is determined according to the following order:  Unknown user if the user code is invalid  Incorrect password, if the code is valid and the password is invalid

- A second message to display is determined by the number of attempts:

Contact your administrator if the user is on their third unsuccessful attempt. The program then stops.

Try again if the user is on their first or second unsuccessful attempt.

Example 1:

Enter your user code: Uqam Enter your password: Z425_H23 Welcome, you have access to the network

Example 2:

Enter your user code: UQaM Enter your password: Z425_H22 incorrect password Try again Enter your user code: Uqom Enter your password: Z425_H23 unknown user Try again Enter your user code: Uqam Enter your password: Z425_H23 Welcome, you have access to the network
Example 3: Enter your user code: Uqam Enter your password: Z425_H22 incorrect password Try again Enter your user code: Uqom Enter your password: Z425_H23 unknown user Try again Enter your user code: Uqom Enter your password: Z425_H22 unknown user Contact your administrator

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_2

Step: 3

blur-text-image_3

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

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago