Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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(

  1. Write a method or code snippet for each of the following problems
    1. 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;

}

  1. Assuming:

String line = ABCDEFGHIJKLMNOP;

Write code to print the contents of line backwards. You must use a loop

  1. 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions