Professional Documents
Culture Documents
Labsw9 113 2020F
Labsw9 113 2020F
public InvalidQuantityException()
{
}
public InvalidQuantityException(String s )
{
super(s);
}
================
}
======================
import java.util.Scanner;
{
super(e,p,q);
flovare = f;
}
import java.util.InputMismatchException;
import java.util.Scanner;
int q = 0 ;
boolean enter = true ;
while( enter )
{
try{
System.out.println("Enter quintity : ");
q = in.nextInt() ;
plist[i] = new Cake( p , e , q , f ) ;
// write
System.out.println("Enter name for write ");
String s = in.next() ;
((Cake)plist[i]).writeName( s ) ;
enter = false ;
}
catch(InvalidQuantityException ex )
{
System.out.println(ex.toString() );
}
}// while
}
}
==========================
public NumberNegativeException(String s)
{
super(s);
}
=================
}
=====================
return false;
}
}
====================
import java.util.InputMismatchException;
import java.util.Scanner;
System.out.println("Enter manufacturer");
String manuf = in.next() ;
int speed = 0 ;
boolean enter = true ;
while(enter)
{
try{
System.out.println("Enter speed : ");
speed = in.nextInt();
}
catch(NumberNegativeException ex )
{
System.out.println(ex);
}
}// loop
// display
for( int i = 0 ;i < 2 ; i++ )
System.out.println(vlist[i].toString() );
}
}
===============================
public InvalidHoursException()
{
}
public InvalidHoursException(String s)
{
super(s);
}
}
=================
}
===================
public Cashier( String name, int ID, double salary, int hours , int
overtim) {
super(name, ID, salary, hours);
this.overtime = overtim;
}
}
==================
import java.util.*;
String name ;
int id , hours , overtim ;
double salary ;
System.out.println("Enter id : ");
id = input.nextInt();
break;
} // try
catch(InvalidHoursException ex)
{
System.out.println(ex.toString() + "Enter new hours : ") ;
hours = input.nextInt();
}
}// while
}// for