-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemNotFoundException.java
More file actions
71 lines (62 loc) · 1.54 KB
/
ItemNotFoundException.java
File metadata and controls
71 lines (62 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* an exception that is thrown when an item from the transaction file isn't in the produceitem, thus resulting in an
* exception thrown that asked for price.
*
*
*
*/
import javax.swing.*;
public class ItemNotFoundException extends IllegalArgumentException{
public String name;
public float missingprice;
public String missingpricecode;
/**
* constructor to set the missing item.
* @param Food
*/
public ItemNotFoundException(String Food){
missingpricecode=Food;
}
/**gets price
*
* @return missing price
*/
public float getPrice2(){
return missingprice;
}
/**
* gets name
* @return name
*/
public String getName3(){
return name;
}
/**
* sets missing price
* @param missingprice
*/
public void setMissingpricecode(float missingprice){
this.missingprice=missingprice;
}
/**
* sets missing name;
* @param name
*/
public void setName(String name){
this.name=name;
}
/**
* joption that gets the price from u and sets it
*/
public void getmissingitemprice() {
Float prices = Float.parseFloat(JOptionPane.showInputDialog(null, "Enter the missing item Price:"+"\t" + missingpricecode));
this.missingprice = prices;
}
/**
* Joption to gets missing name
*/
public void getname2() {
String name=JOptionPane.showInputDialog(null, "Enter the missing item name" +"\t"+ missingpricecode);
this.name=name;
}
}