dimanche 28 avril 2019

Modifyig Java if statements

I need to modify the 10% added to the total; if the subtotal is $1,000 or less keep the 10% additional cost, if subtotal is greater than $1,000 the additional cost will be 5%

I know I need to use an if statement but I can't seem to figure it out correctly.

double totalAmount=airFareCost+foodCost+hotelCost+carCost+shuttleCost; 

double tripTotal=totalAmount+(totalAmount*0.1); {

   if(tripTotal > 1000) {
    tripTotal * 0.5 
} 

else(tripTotal < 1000){ 
tripTotal *0.1)
}

summaryLabel.setText("Summary: Trip Total Cost is $"+tripTotal);

Aucun commentaire:

Enregistrer un commentaire