0% found this document useful (0 votes)
67 views3 pages

CS100 Lab: Problem Solving Tasks

The document provides guidelines and tasks for Lab #05 in the CS100 Computational Problem Solving course for Fall 2020-21. It outlines 4 tasks of varying point values that involve taking user input to determine even/odd numbers, GPA calculations, grocery shopping costs with discounts, and electricity bill calculations based on consumption tiers. Students are instructed to submit all code files in a properly named folder on the LMS system by the lab deadline.

Uploaded by

Malik Mussab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views3 pages

CS100 Lab: Problem Solving Tasks

The document provides guidelines and tasks for Lab #05 in the CS100 Computational Problem Solving course for Fall 2020-21. It outlines 4 tasks of varying point values that involve taking user input to determine even/odd numbers, GPA calculations, grocery shopping costs with discounts, and electricity bill calculations based on consumption tiers. Students are instructed to submit all code files in a properly named folder on the LMS system by the lab deadline.

Uploaded by

Malik Mussab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS100 Computational Problem Solving

Fall 2020-21

Section 1 Wednesday, 21 Oct 2020

Lab# 05: Exercise

Lab Guidelines

1. You are allowed to perform/submit the lab only during the lab timings
2. Make sure you do not leave the lab without submitting your work on LMS
3. Copying/sharing code is strictly prohibited. Using any unfair means will lead to immediate
disqualification
4. Put all cpp files into a folder YourRollNo_Lab5_TAname and submit it on LMS (Assignments>Lab5)
5. Lab ends at 5:50 pm and the submission tab closes at the same time

Task1 Total
15

Task2 Total
20

Task3 Total
30

Task4 Total
35

Total Marks: 100

Let’s Begin
Task 1: [15 marks]

Take an integer as input from the user and print “Its Even” in case the integer is even and “Its Odd”
in case the integer is odd as shown below:

________________________________________________________________________________

Task 2: [20 marks]

Write a program which asks the user to enter the grade that they got in any course and the
program will output the corresponding GPA for it as per the below standards. The GPA decreases
by 0.33 for each change.

A+ is equal to 4.0
A is also equal to 4.0
A- is equal to 3.67
B+ is equal to 3.33
B is equal to 3.0
B- is equal to 2.67
C+ is equal to 2.33
C is equal to 2.0
F is Course Failure

In case of F, output “You have failed”

Sample Output:

Enter the grade in your course: B


GPA: 2.67

Enter the grade in your course: F


You have failed

________________________________________________________________________________
Task 3: [30 marks]

You are going to the local grocery store to buy eggs and bread. The store offers a 10% discount on
your total bill if you are a student. Write a program that,
1. Takes in quantity and price of both eggs and bread.
2. Takes in the user’s budget.
3. Asks whether or not he/she is a student and applies discount accordingly.
4. Calculate the total cost.
5. Prints the budget, cost and whether the cost exceeds the budget or not.

Sample output:

________________________________________________________________________________

Task 4: [35 marks]

Suppose following are the rates of electricity set by the local supplier:

For first 50 units, Rs. 0.50/unit


For next 100 units, Rs. 0.75/unit
For next 100 units, Rs. 1.20/unit
For unit above 250, Rs. 1.50/unit

Write a program which


1. Takes the consumed units of electricity by a user as input.
2. Identifies the correct condition.
3. Calculates the bill given the above conditions.
4. Prints the units and total bill on the screen as below:

(NOTE: Nested if-statements are not allowed. Use “if, else-if, else” structure.)

________________________________________________________________________________

You might also like