CS
Unit5.java

# Unit5.java - *SmithDonaldUnit5.java*Donald Smith*This...

• Homework Help
• 2
• 100% (3) 3 out of 3 people found this document helpful

This preview shows pages 1–2. Sign up to view the full content.

/ ******************************************************************************** ********************* *SmithDonaldUnit5.java *Donald Smith * * *This program takes a max number from the user and executes a number of equation also from user input ******************************************************************************** **********************/ import java.util.Scanner; public class Unit5 //start class { public static void main(String[] args) //start main { Scanner stdIn = new Scanner(System.in); String maxRandNumStr; //variables for input int maxRounds; int maxRanNumInt; System.out.print("Please enter the maximum random number to be used: "); //Prompts user for max number maxRandNumStr = stdIn.next(); maxRanNumInt = Integer.parseInt(maxRandNumStr); //wrapper class to parse string to int for later System.out.print("Please enter the number of rounds: "); //Prompts user for number of rounds maxRounds = stdIn.nextInt(); final String HEADING_FMT_STR = "%5s%9s%14s%11s%11s%12s"; //header format string final String DATA_FMT_STR = "%5d%9d%14f%11f%11f%12f"; //data format string System.out.printf("\n" + HEADING_FMT_STR, "Round", "Rand #", "Fraction F", "sine(f)", "cosine(f)", "tangent(#)"); //table headings int randNum = 0; //defining variables double fractionF; double sinF; double cosF; double tanRandNum;

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Fall '10
• DEAN

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern