输入商品类型number1,数量number2求总收入,哪错了?求解!

public class Task4 {

public static void main(String[] args) {

int number1;

int number2;

   double sum;

String  firstNumber;

String  secondNumber;

firstNumber=JOptionPane.showInputDialog("Enter first number");

secondNumber=JOptionPane.showInputDialog("Enter second number");

number1=Integer.parseInt(firstNumber);

number2=Integer.parseInt(secondNumber);

if(number1==1){

sum=233.99*number2*0.09+200;

}

if(number1==2){

sum=129.75*number2*0.09+200;

}if(number1==3){

sum=99.95*number2*0.09+200;

   }else{

sum=350.89*number2*0.09+200;

   }

JOptionPane.showMessageDialog(null, sum,"Results",JOptionPane.INFORMATION_MESSAGE);

System.exit(0);

}

}


慕粉02102016
浏览 1745回答 1
1回答

慕瓜9220888

ANMYVVBUXNEMIJPFATHEQEDCPYVTUIXKTTCCAOADSFSWJJGYKFFENVLPRMUTDZVHRAVGDWLFHEJVZZFEUIZKSHUQGWREVJBBKKXLFXZUEGYVVIAJRXQJWHRGYWZIIIQQTUCIYUUCDZOUUNVDEVQVXDWSFRRGLQCYGJRFTSQTPFSWKFNMLDPMERQODCCYLHETBQZSFSUBGYNDMNXPWOKCVORKDOZEZYYUYYVDUIYYBODUPXPJVEJWNGBOCLDDIWSEQDYMZYPUKWTYEIXSZSNHHOODOKMLVVOVLSUAMVPTWRIEDIMSFGPPYKJBVYSLSOAFVJWAFDKGBBLYPEOJLVTTQDALKTGJDKYQIAPBRVVBARXTYBLVPLTYUGDQNNIQCNAEBYSVWIUTNIVFBLGZLVSZMOBNIOEHRYKDILBEBSCRSNVTDKDKCMBCXHGMGMBZODFFVHBVTVUACCVRBWFTJENNWAEWVLUGTHLTYMPFYBJGOWVEESIIGIQBODNARRNZYHQQNPGFKORXFVFWBGENKDWAHVKPBRANEYMIHNDWDZAYBQJZCPVJLWEHTMWTRJXTZYEKMQVTXGPFSDUJXZSSSOGTIGBENTGMDIYDJSRULPNSRDGCWIZDIKTQIFBBJODZMTNGKZDCBBDNYOXGYGGCPGDMHFYBHEKBGVKGFFYDSAPNNTSFQXSKTISRYAUSAJSLUEHOKAIBOXAKYNLDTMLIRUZOTDJCVUIKPDTSLYAGGEAXWGKJNLKIIRMVLLQYHDCCPXETVQJAQJYMLPHGWZCTTVQYVZPIMDCKZYEHRWHZXCFLUTFWHMUKDJQJAFNORUKGYPNSKAPMXLSODMVUHXGXSQCSROOKRQLJSCNQBVUESSBROVCBQEENDQICECJCYRUDUCVJJFPMDUFXCLEZCBMNSKWGPPDRZODWNQTQEOPHKGGZSWHGFCRHRHBGXWMVYHDRPOYOHGAVCAVXWWVFSCXWUXTCJCGFDLYEUSBITLGGZCFZGLJLBAQDVAFDZTJZCZUTBAJFVLOVLKSYHXKJHWYRAGFMPJHMHKWWMGXMMUETTMSFEMLDATWAUCKZIBKETHPZHHQWJGGPKBBHRHEIJOTZSLEQBQOWCVOIWTCKCSGFFPGVJYBKQWQUNFNTWBVMEQLNCPSLCPHMXTQMPTDFEZBHNKDMLQYHAXDQKCXWIOEUCWYQFOHDQEFDDCBRRXFTITUKGMPSWETRRRKNEWASRKZZWLNSEDTQXBVZHWUUDNJXOWLJJSSFIMODSMQATTUMHCMLOHDNPNSSYXXZXIHNXAZJXETLTSSBFKBWVTPFCBANCAIYJTQDZNCUDDCWMXVRIBRXAKONLAZZSVEVTFDWCPSTAFEMLBDQKBGOCMSUELIWYWMWFIXESRPPIROTALAZSRHROLUCAKJCRMDIJEBKZDELTOAPLVYQHGLTWLGGHOKZVSLSWLIKPKKDSZOVTIGGWYISZLBNMSPZBBAYQQJMVDQBAWGCKNMTRWNCCLBZWLPOANCJMDRWBONMMCQSUGVVRYEFTQSYHXKPSKZVMWQXHLDYPXGDDZQVTLBHKTOBAIGMMFBGOWWBKDTMXBQYGZMIIVTHWLUTYRESEUWMIHULLKJEKJJG

Tobey_滔

主要判断这一块有问题吧!!!if(number1 == 1){ sum=233.99*number2*0.09+200; } else if(number1 == 2){ sum=129.75*number2*0.09+200; }else if(number1 == 3){ sum=99.95*number2*0.09+200; }else{ sum=350.89*number2*0.09+200; }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java