0% found this document useful (0 votes)
159 views

Programming Fundamentals (Lab) Quiz 01

This document contains instructions for two programming questions for a programming fundamentals quiz. Question 1 asks students to create a calculator program using C++ that evaluates basic math equations with different operators entered by the user. Question 2 asks students to write a program for a rental car company that calculates the rental cost based on days rented and miles driven according to the pricing rules provided. The program should output costs in dollars and cents.

Uploaded by

Danish Irfan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views

Programming Fundamentals (Lab) Quiz 01

This document contains instructions for two programming questions for a programming fundamentals quiz. Question 1 asks students to create a calculator program using C++ that evaluates basic math equations with different operators entered by the user. Question 2 asks students to write a program for a rental car company that calculates the rental cost based on days rented and miles driven according to the pricing rules provided. The program should output costs in dollars and cents.

Uploaded by

Danish Irfan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Programming Fundamentals (Lab)

Course Code: CS-201


Quiz No: 01
Time: 20 Mins
(10+05=15
Marks)

Q1 .Create a simple calculator for addition, subtraction, multiplication, division, and


modulus using switch statement in c + + programming. The user enters a binary equation
as input and the result is displayed. All the numbers must be double but remember that
modulus only work with integer. (Hint: The equation is composed of “double”, “char”,
“double”)

Sample Run 1:
Enter the equation to evaluate: 4 + 5
Answer: 9

Sample Run 2:
Enter the equation to evaluate: 4 % 7
Answer: 4

Sample Run 3:
Enter the equation to evaluate: 5 - 3
Answer: 2

Q2. Write a program for a Rental Car Company, the program should reads the number of days
the car is rented, and the number of miles driven then calculate the cost according to the
following:
 26 $ per day.
 18 cent per mile (100 cent = 1 Dollar)
 The first 100 miles are free.
 5% discount for more than 500 miles.
The cost should be calculated in Dollar and Cent.

You might also like