Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by Swastik ( 6 years ago )
import java.util.Scanner;
class Record_5
{
double quantity;
int matno;
public static void main(String[] args)
{
Record_5 o1=new Record_5();
Scanner scanner = new Scanner(System.in);
System.out.println("The materials are listed below. Please write the material number as described below:-");
System.out.println("1-Cotton");
System.out.println("2-Rayon");
System.out.println("3-Silk");
System.out.println("4-Cotton Silk");
System.out.println("5-Hand spun cotton");
System.out.println("Please enter the material number:");
boolean i=scanner.hasNextInt();
o1.matno=scanner.nextInt ();
if (i==true)
{
if (o1.matno==1 || o1.matno==2 || o1.matno==3|| o1.matno==4 || o1.matno==5)
{
System.out.println("Please enter the qty.(meters) :");
boolean d=scanner.hasNextDouble();
o1.quantity = scanner.nextDouble ();
if (d==true)
{
if (o1.matno==1)
{
double cost = o1.quantity*250;
System.out.println("Cost :Rs." + cost);
}
else if (o1.matno==2)
{
double cost = o1.quantity*150;
System.out.println("Cost:Rs." + cost);
}
else if (o1.matno==3)
{
double cost = o1.quantity*600;
System.out.println("Cost:Rs." + cost);
}
else if (o1.matno==4)
{
double cost = o1.quantity*500;
System.out.println("Cost :" + cost);
}
else
{
double cost = o1.quantity*550;
System.out.println("Cost:Rs." + cost);
}
}
else)
{
System.out.println("You have entered a non double value");
}
}
else
{
System.out.println("You have entered an invalid material number :(");
}
}
else
{
System.out.println("Please enter an int value");
}
}
}
Revise this Paste