Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * <Solar Aquarion>
- * <Student ID>
- * PP1.java
- * Created on <Date>, at <Specific Time>
- */
- /******************************************************************************
- * public class PP1.
- *
- * 1) Declares constant Max with value of 5
- * 2) Declares the integers count and number (=1) in the main method
- * 3) Loops 5 times with Max bounding the iteration
- * a) Changes the Value of number by adding the current value * Max to itself
- * b) Outputs this value on a separate line for each iteration
- * 4) After the loop, declares and assigns the variable total as having the
- * LAST value of number divided by three in such a way that the answer
- * will have decimal points.
- * 5) Outputs the total with he string "Output is: " followed by the value of
- * the total in such a way that there is space between the string and the
- * value of total
- * @author SolarAquarion
- *****************************************************************************/
- public class PP1
- {
- //Fields
- final static private int Max = 5; //(1)
- //Methods
- public static void main(String [ ] args)
- {
- int count, number = 1; //(2)
- for (int i = 0; i < Max; i++) //(3)
- {
- number += (number * Max); //(3a)
- System.out.println("At iteration " + (i + 1) +
- ", the value of number is: " + number); //(3b)
- } //for i < Max
- double total = (double)number / 3.00; //(4)
- System.out.println("Output is: " + total + "\n");
- } //main()
- } //class PP1
Advertisement
Add Comment
Please, Sign In to add comment