Question
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.
- 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).
- 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
- 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
********************************************************
- Write a program to do #1 above
- Write a program to do #2 above
- Write a program to do #3 above
- 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.
- 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 mStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started