Question: Write a method or code snippet for each of the following problems Rewrite the following as a for loop: int i=5, value = 0; while(
- Write a method or code snippet for each of the following problems
- Rewrite the following as a for loop:
int i=5, value = 0;
while( i<=20){
if ( i % 2 == 0 && i <= 10)
value = value + i * i;
else if (i % 2 == 0 && i > 10)
value = value + i;
else
value = value - i;
}
- Assuming:
String line = ABCDEFGHIJKLMNOP;
Write code to print the contents of line backwards. You must use a loop
- During tax season, Vision Accounting, offers reduced assistance for low income individuals. Their normal hourly rate is $60.00/hour, charged at 20 minute intervals. Write a code snippet (or main program) that tells how much it would cost an individual to get help with their taxes:
- if the individual is low income ( income <= 25000), assistance is free
- if the individuals income is <= 50000,
- if the session is <= 20 minutes it is still free
- for > 20 minutes, for each 20 minutes it is 1/2 of the normal hourly rate
- for individuals making over 50000 the normal hourly rate is used, calculated at 20 minute intervals
prompt the user for the individuals income and the length of the appointment
Be sure to print out the persons income, length of the appointment and the cost
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
