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

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

View Full Document Right Arrow Icon
/ ******************************************************************************** ********************* *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;
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern