Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SUBJECT: Algorithms, Compiling, Debugging Goal: Enter and compile a program. Write an algorithm (psuedo code) to calculate the shaded area of the object below Algorithm

SUBJECT: Algorithms, Compiling, Debugging

Goal: Enter and compile a program.

  1. Write an algorithm (psuedo code) to calculate the shaded area of the object below

Algorithm should be general: It should work for all values of A,B,C,D and different number of boxes (top drawing below shows 3 x 3 shaded boxes and 1 x 1 white boxes, the bottom drawing has different). Do not assume A=B or C=D (as shown in the first diagram). Do not assume that the boxes are 3x3 and 1x 1. Dimensions A & B refer to the small box indicated by the dotted line. The second image shows a second possible object. Your algorithm should work for both images. USE GOOD VARIABLE NAMES (NOT ABCD).

image text in transcribed

  1. Write an algorithm to calculate the interest on a loan and the remaining balance after a specified payment is made. Interest and payment are made at the end of the year
  1. Write an algorithm to determine insurance company payment and your payment

You may assume that the total charges are greater than the deductible

.

Deductible $1000 you pay all charges until this amount is reached.

Co pay 20% after the deductible after the deductible is used you pay this amount of charges

Prescription co pay $40 payment for each prescription, Insurance company pays rest. (not included in deductible)

The algorithm should be general but try the algorithm for this example

Total charges $5000

Prescriptions 3 for $65 each

********************************************************

Show me the algorithms before proceeding

********************************************************

  1. Write a program to do #1 above
  2. Write a program to do #2 above

  1. Write a program to do #3 above
  1. Look at the code of program 4. (below) Enter the program, Add appropriate blank lines and tabs. Add appropriate comments, Add printlns as per your template compile and run it. Determine what algorithm is used and correct it if necessary.
  1. Hand in the source code for all programs and sample output. Make sure you use appropriate comments and that your name is on all code and output.

//Program 4

public class Lab2d

{public static void main (String[] args)

{int sum;sum=0;sum=sum+96;sum=sum+70;sum=sum+85;sum=sum+60;

System.out.println("Sum is initially set to "+ sum);System.out.println("Sum is now "+ sum );

System.out.println("Sum is now "+ sum );System.out.println("Sum is now "+ sum );

System.out.println("The final sum is "+ sum );

}

}

B D C m

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+ If strikes occur, are they legally regulated?

Answered: 1 week ago

Question

=+industrial action Under what circumstances can unions strike?

Answered: 1 week ago

Question

=+What forms of industrial action are common?

Answered: 1 week ago