## Description

Part A: This question is to be submitted to the instructor in the form a Word document containing the Java code and a screen capture of the output. Upload the file to CMS.

1. You can use Cramer’s rule to solve the following 2 x 2 system of linear equations: ax + by = e x = ed – bf y = af – ec cx + dy = f ad – bc ad – bc

Ask the user for the values of a, b, c, d, e, and f, then display the functions. Finally, solve for the values of x and y using Cramer’s rule and report the result.

Write a program that solves the following equations and displays the values for x and y: a) 4.3x + 12.5y = 43.6 -3.4x + 5.4y = 22.8 b) -2.4x + 3.6y = -3.6 5.1x – 6.8y = 8.5

Provide screen shots showing the answers for each set of linear equations. (One screen shot for each).

2. Write a program which prompts the user to enter a number of seconds and then reports the number of years, days, hours, and minutes the number represents.

Please enter a number of seconds: 65000000000 [Enter] 65000000000 seconds is approximately 2061 years, 49 days, 19 hours, 33 minutes and 20 seconds.

Demonstrate the program using: 65000000000, 123456789, and 987654321 (One screen shot for each)

COSC 1046 (F17) – Introduction to Computer Science Part B: Write code and test the solutions for the following problems from the textbook. Submit the .java files for each question to CMS. The answers are due on September 29th and the programs are to be demonstrated to the Teaching Assistant (Tim) by October 6th. He will ask questions to make sure you understand the material.

1. (Not from textbook) Write a program that reads in the radius of a sphere and computes the surface area and volume of the sphere using the following formulas: A = 4r2 V = 4/3 x r3 Enter the radius of the sphere: 2.5 [Enter] The surface area of the sphere is 78.53982 The volume of the sphere is 65.44985

2. Problem 2.13 – modified (pg.72) Solve the problem as written with one modification – ask the user to provide the annual interest rate and use this rate to calculate the account value after six months.

Enter the monthly saving amount: 100 [Enter] Enter the annual interest rate (%): 5 [Enter] At the end of the sixth month, the account value is $608.81

3. Problem 2.19. For this problem, the values side1, side2 and side3 are the lengths of each size. To calculate the length of a side, where the end points are provided as points (x1, y1) and (x2, y2), use the following formula:

?????????? = √(?? − ??)? + (?? − ??)?

First, use the above formula to calculate the length of each side (side1, side2 & side3). Then, calculate s and area using the formulas provided in the question.

Additionally, the program should report the perimeter of the triangle. The output should be something like this:

Enter three points for a triangle: 1.5 -3.4 4.6 5 9.5 -3.4 The area of the triangle is 33.6 The perimeter of the triangle is 26.7

Note: The answers need to be adjusted to show only a single decimal place. See the slides/textbook for how to accomplish this.