Question: I am using jgrasp and need help with question 8 with if statement. It still shows error when i run it. Please help. import java.util.Scanner;

I am using jgrasp and need help with question 8 with if statement. It still shows error when i run it. Please help.

import java.util.Scanner;

public class Question_8_Ch_3

{

public static void main(String[]args)

{

Scanner input = new Scanner (System.in);

final int price = 99;

System.out.println("Enter the quanity you wish to purchase");

int quantity = input.nextIn();

double discount;

double pay;

double ActualPurchase;

if (quantity>=100)

{

pay = price*quantity;

discount = pay*0.5;

ActualPurchase = pay-discount;

System.out.println("The discount is" +discount+ "and you will pay" +ActualPurchase);

}

else

if((quantity>=20)&&(quantity

{

pay = price*quantity;

discount = pay*0.4;

ActualPurchase = pay-discount;

System.out.println("The discount is" +discount+ "and you will pay" +ActualPurchase);

}

else

if((quantity>=20))&&(quantity

{

pay = price*discount;

discount = pay*0.3;

ActualPurchase = pay-discount;

System.out.println("The discount is" +discount+ "and you will pay" +ActualPurchase);

}

else

if quantity>=10)&&(quantity

{

pay = price*quantity;

discount = pay*0.2;

ActualPurchase = pay-discount;

System.out.println("The discount is" +discount+ "and you will pay" +ActualPurchase);

}

else

System.out.println("The quatity is too small to be purchased");

}

}

I am using jgrasp and need help with question 8 with if

C3 Chapma x H MD3_GADD2213_07_SE_. x KB Reunts|metedbyamt 3: Kg] FewStepsstepatateyout xYG inminnpane-Goagle Se; x\\D e X C ' 3 Secure ' hpswapptboxcom/s/hS'quE'hlqungyxabpukc7y73yr 3} E Apps E1! SmarlBuok A DerellconofDuty:.' W My RecenLly matted F'Mes > MULGAD02113,07,5E,c03.pdv \\ Ga to My Accnunt pmgram would display: - Andy Chenil- mutt IL Will\" A sufrwam {I'llp'ally nL-Eh apeckagl'lhar mutt; lutwy. Quantity distant\": ant-gm: mm mgmxhcldhwmglahlnt Quanlity DiImIllll 1049 20% 2D49 30% \\ .1me t. Q m. my...' \\ \\ pragnllnlnaCl'lallElgB um Quantity Diaml' SW99 40% IDCI Dr mn- 50% Write a program that nah the M [0 enter the numhcr 0! packages purchased. Th: pwam Ihoukl tttttt diiplay lhc amwlll nl [hcdiacoum nutty) and the total mun: olthc gmhm aftL-r \"IE dinmlmt 9. Shippil' lil'gnl 11m I-lst might Shipping (human)! charges (In: lu|luwing Ian's: Weigh! rming: ampetsuu Mile! Shipped 2 ptmttusut In: sun) Ovl'f 2mm: but nal lnnrl' than 6 puttmk 52.29 mm a pnund: but not mm man 10 puundt 13.70 v E Type here to search

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!