0

how to seperate line output for itemprice>500

import java.util.Scanner; public class itempurchase{ public static void main(String[]args){ Scanner input=new Scanner(System.in); double itemprice; double actualpayment; double discount; System.out.print ("total price of item: "); itemprice=input.nextDouble(); actualpayment=itemprice-(itemprice*0.10); discount=(itemprice*0.10); if (itemprice>500) System.out.println ("discount of item= "+ discount + "actual payment = " + actualpayment ); else System.out.println ("actual payment= " + itemprice); } }

22nd Feb 2021, 4:37 AM
Iman Qasrina
5 Respuestas
+ 2
Separate line output? like what for example?
22nd Feb 2021, 4:51 AM
Ipang
+ 2
Yep good job! 👍
22nd Feb 2021, 5:01 AM
Ipang
+ 1
Add \n to produce a newline. Example: System.out.println("Carrie\nForle"); Output: Carrie Forle
22nd Feb 2021, 4:41 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
i want my output seperate like this discount of item= actual payment= not this discount of item= actual payment= well it have been solved😊
22nd Feb 2021, 4:54 AM
Iman Qasrina
0
it work!!thank youu
22nd Feb 2021, 4:49 AM
Iman Qasrina