Okay here is the assignment. I need to use a for loop to solve this problem.
You are offered two salary options for ten days work. Option 1: $100 per day.
Option 2: $1 for the first day, $2 for the second day, $4 for the third day, and so on,
I have already figured out a way to solve the first portion of the problem. But the 2nd problem is giving me a hard time
/** * * * CSC 225 - Online * Problem 8 */ import java.text.*; public class PBS5_8 { public static void main(String [] args) { double optionOne, optionTwo, increment, sum1, sum2; optionOne = 100; optionTwo = 1; sum1 = 0; sum2 = 0; for(increment = 1; increment <= 10; ) { sum1 = sum1 + optionOne; sum2 = sum2 + optionTwo * 2; increment++; } System.out.println(sum1); System.out.println(sum2); } }
Here is my output!
1000.0
20.0
Okay 20.0 should really be 1023.00 but I don't know how to make the value multiple itself and then add it to the sum. Is there any suggestions? FYI I already written the arithmetic but the coding portion is giving me a hard time.