Fundamental of CS
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →CSC 2250 Fundamentals of Computing System Lab 2 1. (40 points): below is a java program that prompts user to enter an integer and then calculate the expression y = 3*x*x + 5*x +8, and display the result. public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); System.out.print(“Enter an integer value: “); int x = myScanner.nextInt(); int y = 3*x*x + 5*x + 8; System.out.println(“The result is: ” + y); } The sample run for the java program above: Write a MIPS program to compute the expression as the Java program does. (1) Screenshot of your program: [Load your program into QtSPIM and run your program. Take a screenshot showing program code and register values.] (2) Test cases (screenshot of result, showing input/output): 2. (60 points): Write a SPIM program that computes the volume and surface area of a rectangular parallelepiped. The formulas for calculating volume and surface area are as follows: • 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 = 𝑎𝑎𝑎𝑎𝑎𝑎 where 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 are the sides of rectangular parallelepiped respectively. • 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 = 2(𝑎𝑎𝑎𝑎 + 𝑏𝑏𝑏𝑏 + 𝑎𝑎𝑎𝑎) Your SPIM program • defines variables 𝑎𝑎, 𝑏𝑏, 𝑐𝑐, 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣, and 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 • prompts user to enter three integers and store them to variable 𝑎𝑎, 𝑏𝑏, 𝑐𝑐 respectively • computes the volume and stores the value to the variable 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 • computes the surface area of the rectangular parallelepiped and stores result to the variable 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠. • Display the results like this: for example, the volume is 8 and the surface area is 10 The volume of the rectangular parallelepiped is 8 The surface of the rectangular parallelepiped is 10 (1) Screenshot of your program: [Load your program into QtSPIM and run your program. Take a screenshot showing program code and register values.] (2) Test cases (screenshot of result, showing input/output): Program Grading Rubric Each program is graded using the following rules: (1) Your program is assembled successfully: 30% (2) Your program works as expected: 50 % (3) Your program follows style guidelines, including correct program header: 10 % (4) Your program is commented properly 10%
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds