C++ Fundamentals Practice Questions 5 - Wisdom Lighter

Tuesday, 22 May 2018

C++ Fundamentals Practice Questions 5




Fundamentals of programming

Q1:

Write a program to mimic a calculator. Input two int numbers and state whether
the numbers are to be added, subtracted, multiplied or divided. Cater for the possibility
of denominator being zero in the division two numbers
Use type casting in case of division.

Q2:

A bicycle shop in Hyannis rents bicycles by the day at different rates throughout the year,
according to the season (see table below).The proprietor also gives a 25% discount if the
rental period is greater than 7 days. Renters must also pay a 50$ returnable deposit for each bicycle rented.
Write a program to input the season and the number of days of rental and then calculate and display the total charge that includes the deposit. (Use if-else if statement Or switch statement)

  
Season
Charge
S[spring]
$5.00
M[Summer] 
$7.50
A[Autumn] 
$3.75
W[Winter] 
$2.75




No comments:
Write comments