0
Can someone fix this code for me,🤔😁
import java.util.Scanner; public class Main{ public static void main(String args[]){ double interest; double years; double money; Scanner it = new Scanner(System.in); System.out.println("Enter the amount of money "); int x = it.nextInt(); System.out.println("Enter the number of years "); int y = it.nextInt(); for(int i = 0; i < years; i++){ interest = money/10; money += interest; } System.out.println("money"); } } Interest is compounded annually at 10% by a certain bank. Make a program that would input an amount and a number of years (the program should test that both are positive) and output how much the original amount will be worth after that period.*/
9 Réponses
+ 1
import java.util.Scanner;
public class Main{
public static void main(String args[]){
double interest;
double years;
double money;
Scanner it = new Scanner(System.in);
System.out.println("Enter the amount of money ");
money = it.nextInt();
System.out.println("Enter the number of years ");
years = it.nextInt();
for(int i = 0; i < years; i++){
interest = money/10;
money += interest;
}
System.out.println("money="+money);
}
}/*
+ 2
If you have made x and y variables then what is the use of years and money?
+ 1
Atul oh i see😅🤦🏻♂️
+ 1
This will be the correct answer
+ 1
Atul thanks sir 😁
+ 1
My pleasure, but please don't call me sir, call me Atul
+ 1
Atul thanks again my friend atul🤗
- 2
Think of it as human
We have
head and
Body
Then put the in tag. Oprn and close tag.
<html>
<head></head>
<body></body>
</html>
This is the skeleton. the foundation
- 3
As you comment in other deleted post.... requesting in description for an OOP implementation...
This is valid for you?
Object Oriented Programming + Functional Programming + Inmutability
I took as a challenge for me. 🤗🤗
ADVICE: If is for your job or homeworks... all rights are reserved and code comes without any warranties
https://code.sololearn.com/cMTfGunOPj0I/?ref=app