1. A. Create the logic for a program that calculates and displays the amount of
ID: 3554089 • Letter: 1
Question
1. A. Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 3 percent interest for one year. Create a seperate method to do the cacualtion and display the result.
B. Modify the interst-caculating program so the caculated value is returned to the main program where it is displayed.
2. Create an application class whose main() method holds two numeric variables. Prompt the user for values for the variables. In a loop that continues while the returnded value is N, pass both variables to a method that determines whether the first number is larger then the second and appropriately returns a character Y or N. After the method returns Y, pass the two numbers to a method named difference() that computes the difference between its two parameters and displays the result.
3. Create the logic for an application that contains a main() method that continuously prompts the user for a number of dollars until the user enters (). Pass the amount to a conversion method that displays the breakdown of the passed amount into the fewest bills; in other words, the method caculates the number of 20s, 10s, 5s, and 1s needed.
Explanation / Answer
1
public class tempClass {
public static void main(String[] args) {
tempClass c = new tempClass();
System.out.println("Interest Calculated :"+c.calculate());
}
public double calculate(){
double p = 5000;
double r = 3;
int t = 1;
return ((p*t*r)/100);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.