IT/솔루션) Power Java
Power JAVA 4장 ) 자바프로그래밍 기초 - Programming_2
돔찌
2019. 4. 19. 07:59
<2016. 10. 3. 18:39>
Power JAVA 4장 ) 자바프로그래밍 기초 - Programming_2
/* 상점에 가면 우리는 상품에 대한 돈을 내고 영수증을 받는다.
* 영수증에는 10% 부가세와 잔돈 등이 인쇄되어 있다.
* 구입한 상품의 가격과 손님한테 받은 금액을 입력하면 부가세와 잔돈을 출력하는 프로그램을 작성하여 보자.
*/
import java.util.Scanner;
public class Programming_2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int getmoney;
int price;
double plusprice;
double change;
System.out.print("받은 돈 : ");
getmoney = input.nextInt();
System.out.print("상품의 총액 : ");
price = input.nextInt();
plusprice = price/10;
change = getmoney - price;
System.out.println("부가세 : "+ plusprice);
System.out.println("잔돈 : "+ change);
}
}