You are on page 1of 4

CS 101 Computing & AI

Assignment 01
Date of Announcement: 10-09-2022 Submission Deadline: 10-16-2022 Mid Night (11:59 PM)

Instructions
● You are required to submit a separate C++ file for each Question.
● Each file should be named with the Question Number e.g. question_09.cpp
● Make sure your code is compiling before submission, if the code does not compile for a
particular question it will be graded 0.
● Each variable in your code should be modified with the last 3 digits of your registration
number as well as the first 3 alphabets of your name.
○ E.g. Student name: Ali, Registration u2022012
○ Each variable in the code should look like this: int ali_num1_012;
○ Another example for naming the variable num2, and salary of int data type
■ int ali_num2_012, ali_salary_012;
● You are required to provide hard copies (handwritten) of these codes as well. Cpp
file submission is a required tool.
● Late submissions will receive -25% for each day. Hence, after 4 days your assignment
will receive 0 marks.
● Cheating will not be tolerated. All identicals assignment will be graded 0.

Question 01
A. Which datatype will I use if I want to store the following variables in C++?
● Name of a Person (5 Alphabets Only)
● Age of a Person
● Salary of a Person
● Name of Days (As the calendar shows one alphabet).
● Birth Year of a Person
● 34.0691, 72.6441
○ (These are the real Latitude and Longitude of our GIK Institute)
B. Write a C++ program to input these values from the user and display each value
afterward.

Question 02
Given an employee’s gross salary of the month and tax rate, calculate the Net salary. Make
sure to play the beep twice before you tell the employee his final salary.

Question 03
Calculate the area of a triangle given its base and height are given. Display the output along
with the provided input. Make sure your output is pretty, users don’t like ugly screens.
*************************************************************************

Base of the Triangle: 20 Height

of the Triangle: 15 Area of the

Triangle: 150

***********************************************************************

Question 04
Punjab Government has reached you to write their application which inputs a person's name (3
alphabets only), age, gender (m/f), and vaccination status (y/n). This information is displayed
on the screen for verification purposes in the following format. Please write a C++ program to
obtain this output.

Name: AKK
Age: 31 years old
Sex: Male
Vaccinated: Yes

Question 05
A physics teacher is very excited to show his students some quick calculations of distance
given the initial velocity, time, and acceleration. He knows your ability to write an awesome
application in C++ which can provide a pretty representation of the given and found values.

Given:

Initial Velocity: 0.0 m/s Acceleration: 2.0 m/s*s

Time: 10.0 s

Solution:
Distance Covered: 100.00 m

Question 06
In the 2021 entrance test of GIKI 6200 applicants registered for the test. However, only 650
were admitted to the University. In the year 2022, the applications received by GIKI reached
8200 and 800 applicants were admitted this year. The Rector of the institute wants to know
which year a higher percentage of the students passed the test. You are requested to write a
C++ application that will provide the solution.
Question 07

Calculate the value of E using the following expression:


E = 17x - 20y - 4(x + 9y)
Question 08
A. Write a C++ program to display the following output.

B. Write a C++ program to display the following output.


Question 09
A. Write a C++ program to display the following output.

B. Write a C++ program to display the following output.

You might also like