|
2nd Midterm Exam
|
1. Write a subroutine that calculates the position, velocity and acceleration of a body undergoing simple harmonic motion using the equations below:
position = asin (nt+ε) velocity= nacos(nt+ε) acceleration = -an2sin(nt+ε)
Use as starting values n= 3.14159265, ε=0, a=2.5. Test the program by specifying your own set of values.
2. Write a program that calculate 2x2 matrix multiplication by using the command matmul.
3. Write a program that reads the grades from "prices.txt" (contains 10 different prices of goods., and writes a file named "mean_prices.txt" that contains the arithmetic average of the grades and also print maximum and minimum prices to the screen either.
Prices txt is included to following values.
150 180 467 78 64 123 456 76 98 235
4. Using a case or if structure to preparing a computer program which shows your daily program on week day. (such as : waking up at 8:00 am, breakfast at 8:30 am, go to class at 8:45 am etc.)
Results: 1. Program codes ("harmonic_motion.txt") Module codes ("harmonic_motion_mod.txt")
2. Program codes ("matrix_c.txt")
3. Program codes ("price_calculation.txt") Input file ("prices.txt") Output file ("mean_prices.txt")
4. Program codes ("daily_program.txt") |
|
|