ENGR131 – Homework 4: MethodsDue at 11:59 PM on Tuesday October 2, 2007. Submit all .java files as required by your TA. Grading: Problem 1a (20 pts). Problem 1b (20 pts). Problem 1c (20 pts). Problem 2 (30 pts). General (10 pts). Instructions:The main focus of this assignment is the use of methods and how they provide better code organization and reduce duplicate code. You will also gain more experience using loops, selection, and the Math.random() method. Write a separate program (.java file) for each problem. Note that both problems require console input and/or output (I/O). 1. Write a program that evaluates a formula using values entered by the user. Choose any formula you wish, but it must use at least two variables. Use console I/O (Scanner and print). The following is an example (do not use this one) that computes the sum of two variables: Enter value for a: 1.2 Enter value for b: 3.4 The sum is 4.6. a. Write a method called getNumber()that receives a prompt and returns a value entered by the user. It should display the prompt and get the value from the user as shown in the
This is the end of the preview.
access the rest of the document.