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.*/

8th Feb 2021, 4:40 PM
Marlou Abing Edem
Marlou Abing Edem - avatar
9 Answers
+ 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); } }/*
8th Feb 2021, 5:07 PM
Atul [Inactive]
+ 2
If you have made x and y variables then what is the use of years and money?
8th Feb 2021, 5:06 PM
Atul [Inactive]
+ 1
Atul oh i seešŸ˜…šŸ¤¦šŸ»ā€ā™‚ļø
8th Feb 2021, 5:07 PM
Marlou Abing Edem
Marlou Abing Edem - avatar
+ 1
This will be the correct answer
8th Feb 2021, 5:08 PM
Atul [Inactive]
+ 1
Atul thanks sir šŸ˜
8th Feb 2021, 5:10 PM
Marlou Abing Edem
Marlou Abing Edem - avatar
+ 1
My pleasure, but please don't call me sir, call me Atul
8th Feb 2021, 5:12 PM
Atul [Inactive]
+ 1
Atul thanks again my friend atulšŸ¤—
8th Feb 2021, 5:25 PM
Marlou Abing Edem
Marlou Abing Edem - avatar
- 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
10th Feb 2021, 9:29 AM
HERAWATI
HERAWATI - avatar
- 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
9th Feb 2021, 7:01 PM
David OrdƔs
David OrdƔs - avatar