Starting from:

$34.99

CS104 Lab 2 Solution


Your programs should start with the following comments: (do not forget to change the name)
# This program prints several lines.

1. Write a program that prints the following lines (Replace NAME with your name):

/_/
/ o o
~ / Hello “NAME”!


2. In physics, a common useful equation for finding the position s of a body in linear motion at a given time t, based on its initial position s0, initial velocity v0, and rate of acceleration a, is the following:

S=s0 + v0*t + 1/2*a*t2

Write a program in which you compute and print s for the following initial values:

s0 with a value of 12, v0 with a value of 3.5, a with a value of 9.8, and t with a value of 10.

You should not get 47.0

The value of s is 537.0

Use variables in your solution.


3. Three friends are going to rent a house. The possibilities are Taşdelen (1300TL), Çekmeköy (1500TL), Üsküdar (1800TL) and Kadıköy (2000TL). Additionally, they will share the monthly contribution (aidat) which is 10% of the rent.

Write a program which calculates how much each person should pay in each case.

You should get the following output:

Taşdelen: 476.6666666666667
Çekmeköy: 550.0
Üsküdar: 660.0
Kadıköy: 733.3333333333334

Use variables in your solution.

4. You will write a program which calculates the GPAs of two students Merve and Özlem. Their grades and the grading system are given below. You will calculate and print their GPAs.

Merve:
CS101 A 6 credits
ENG101 B- 4 credits
MATH103 C+ 6 credits
PHYS101 D+ 8 credits
TLL101 A- 4 credits

Özlem:

CS101 B+ 6 credits
ENG101 C 4 credits
MATH103 A- 6 credits
PHYS101 D 8 credits
TLL101 A 4 credits

Here is the grading system:

A 4.00
A- 3.70
B+ 3.30
B 3.00
B- 2.70
C+ 2.30
C 2.00
C- 1.70
D+ 1.30
D 1.00
F 0.00

Özlem's GPA is 2.642857142857143
Merve's GPA is 2.6357142857142857

More products