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

Spring 2023 - CS201 - 1

This document provides instructions for Assignment 1 for the course CS201 - Introduction to Programming. It states that the assignment is due on May 20th, 2023 and outlines objectives related to data types, operators, control structures and functions. It provides details of an assignment question involving calculating the distance an object falls using a given formula, time data and instructions to write a C++ program with a fallingDistance function, loop to call it and calculate the average distance. Submission must be only the .cpp file through the LMS by the due date to receive credit.

Uploaded by

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

Spring 2023 - CS201 - 1

This document provides instructions for Assignment 1 for the course CS201 - Introduction to Programming. It states that the assignment is due on May 20th, 2023 and outlines objectives related to data types, operators, control structures and functions. It provides details of an assignment question involving calculating the distance an object falls using a given formula, time data and instructions to write a C++ program with a fallingDistance function, loop to call it and calculate the average distance. Submission must be only the .cpp file through the LMS by the due date to receive credit.

Uploaded by

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

Assignment No.

1 Total Marks: 20

Semester: Spring 2023 Due Date: 20th


May,2023
CS201 – Introduction to Programming
Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:

• Assignment is submitted after due date.


• Submitted assignment does not open or file is corrupt.
• Assignment is copied (From internet/students).

Recommended tool to develop Assignment


• Dev C++

Objectives:
To enable students to understand and practice the concepts of:
• Data Types and Variables
• Arithmetic and Logical Operators
• Expression solving
• If-else statements
• Repetition structure
• Functions

Assignment Submission Instructions


You have to submit only.cpp file on the assignments interface of CS201 from your LMS
account. Assignment submitted in any other format will be scaled with zero mark.
So, check your solution file format before submission.

For any query related to assignment, please contact [email protected].

Lectures: 1 to 9

Assignment Statement
When an object falls because of gravity, the following formula can be used to determine the
distance the object falls in a specific time period:
1 2
d= g t
2

Whered is the distance in meters, g is 9.8(constant of gravity) and t is the amount of time, in
seconds, that the object has taken to fall.

You need to write a C++ program that has:

1. A function fallingDistance which:


 Accepts an object’s falling time (in seconds) as an argument.
 Calculates the distance, in meters, that the object has fallen in that time.
 Returns this calculated distance.

2. In the main() function there is a:


 A loop struct in which:
 the function fallingDistance is called passing data given in the table.
 Sum of all these distances is calculated.

 Average distance is calculated and displayed.

3. Following is the time data:


Time(seconds)
1
3
5
7
9

4. You can use any of the loop structs like…for-loop, while or do-while loop.

5. The formula to calculate average is:


Average = (sum of values) / number of values

6. It is required that you use the given data set otherwise marks will be deducted.

Sample screenshot of the program is given below:

Lectures Covered: 1 to 9
Due date: 20th May, 2023

You might also like