Skip to content

Commit 1ea72cd

Browse files
author
hajajmaor@gmail.com
committed
app build before menu
1 parent d3f598b commit 1ea72cd

File tree

11 files changed

+129
-45
lines changed

11 files changed

+129
-45
lines changed

.classpath

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4-
<classpathentry kind="src" path="src"/>
5-
<classpathentry kind="output" path="bin"/>
3+
<classpathentry kind="con"
4+
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
5+
<classpathentry kind="src" path="src" />
6+
<classpathentry kind="output" path="bin" />
67
</classpath>

.project

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<projectDescription>
3-
<name>OOPCourse</name>
4-
<comment/>
5-
<projects>&#xD;
3+
<name>OOPCourse</name>
4+
<comment />
5+
<projects>&#xD;
66
</projects>
77
<buildSpec>
88
<buildCommand>

bin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/app/

bin/app/App.class

1.72 KB
Binary file not shown.

bin/app/Borrow.class

52 Bytes
Binary file not shown.

bin/app/Member.class

9 Bytes
Binary file not shown.

bin/app/Purchase.class

-203 Bytes
Binary file not shown.

src/app/App.java

Lines changed: 91 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,105 @@
11
package app;
22

3+
4+
import java.util.GregorianCalendar;
5+
import java.util.HashMap;
6+
import java.util.Map;
7+
import java.util.Scanner;
38
import java.util.Vector;
49

510
public class App {
6-
7-
public static void main(String[] args) throws Exception {
8-
Vector<Book> books = new Vector<Book>();
9-
Vector<Member> members = new Vector<Member>();
10-
Vector<Borrow> borrows = new Vector<Borrow>();
11-
Vector<Purchase> purchases = new Vector<Purchase>();
12-
Vector<Supplier> suppliers = new Vector<Supplier>();
13-
11+
12+
public static Vector<Book> books = new Vector<Book>();
13+
public static Vector<Member> members = new Vector<Member>();
14+
public static Vector<Borrow> borrows = new Vector<Borrow>();
15+
public static Vector<Purchase> purchases = new Vector<Purchase>();
16+
public static Vector<Supplier> suppliers = new Vector<Supplier>();
17+
18+
//which data type to work with?
19+
public static Map<Integer, Book> books2=new HashMap<Integer, Book> ();
20+
21+
static void fillData() {
22+
try {
1423
books.add(new Book(123, "Victor The Great", 20, 1890, 20));
1524
books.add(new Book(12333, "Aigon The Beast", 20, 1960, 20));
1625
books.add(new Book(1456, "Dora The Explorer", 20, 2016, 20));
1726

18-
members.add(new Member("121515", "Haim Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
19-
members.add(new Member("121567", "Itzik Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
20-
members.add(new Member("121855", "Yeal Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
27+
members.add(new Member(121515, "Haim Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
28+
members.add(new Member(121567, "Itzik Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
29+
members.add(new Member(121855, "Yeal Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
30+
members.add(new Member(121855, "David Azulay Reader", 5, 0, 25, "054-1234567", "shimon peres 10, Rehovot"));
2131

2232
suppliers.add(new Supplier(123, "Hobbit Inc.", "056-6556666", "shimon, Rehovat"));
33+
suppliers.add(new Supplier(123, "Rabbit Inc.", "056-6556666", "shimon, Rehovat"));
34+
suppliers.add(new Supplier(123, "Toys Inc.", "056-6556666", "shimon, Rehovat"));
35+
suppliers.add(new Supplier(123, "Pets Inc.", "056-6556666", "shimon, Rehovat"));
36+
37+
purchases.add(new Purchase(123, 3, books.elementAt(0), new GregorianCalendar(2019,5,10)));
38+
purchases.add(new Purchase(124, 3, books.elementAt(1), new GregorianCalendar(2019,6,10)));
39+
purchases.add(new Purchase(125, 3, books.elementAt(2), new GregorianCalendar(2019,8,10)));
40+
purchases.add(new Purchase(126, 3, books.elementAt(2), new GregorianCalendar(2019,9,10)));
41+
42+
43+
borrows.add(new Borrow(20, new GregorianCalendar(), members.elementAt(0), books.elementAt(0)));
44+
borrows.add(new Borrow(20, new GregorianCalendar(), members.elementAt(1), books.elementAt(1)));
45+
borrows.add(new Borrow(20, new GregorianCalendar(), members.elementAt(2), books.elementAt(2)));
46+
47+
48+
49+
}
50+
catch (Exception e) {
51+
System.out.println(e.getStackTrace());
52+
}
53+
}
54+
55+
public static void main(String[] args) {
56+
fillData();
57+
Scanner scan=new Scanner(System.in);
58+
try
59+
{
60+
boolean run=true;
61+
int chocie;
62+
System.out.println("enter number for task: ");
63+
chocie=scan.nextInt();
64+
while(run==true) {
65+
switch (chocie) {
66+
case 1:{
67+
68+
break;
69+
}
70+
case 2:{
71+
72+
break;
73+
}
74+
case 3:{
75+
76+
break;
77+
}
78+
case 4:{
79+
80+
break;
81+
}
82+
case 0:{
83+
run=false;
84+
break;
85+
}
86+
87+
default:
88+
break;
89+
}
90+
91+
}
92+
System.out.println("Hello Java");
2393

24-
System.out.println("Hello Java");
94+
95+
}
96+
catch (Exception e) {
97+
System.out.println(e.getStackTrace());
98+
}
99+
finally {
100+
scan.close();
101+
}
102+
103+
25104
}
26105
}

src/app/Borrow.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package app;
22

33
import java.util.Date;
4+
import java.util.GregorianCalendar;
45

56
public class Borrow {
67
private int days;
7-
private Date date;
8+
private GregorianCalendar date;
89
private Member member;
910
private Book book;
1011

11-
public Borrow(int days, Date date, Member member, Book book) {
12+
public Borrow(int days, GregorianCalendar date, Member member, Book book) {
1213
this.days = days;
1314
this.date = date;
1415
this.member = member;
@@ -18,7 +19,7 @@ public Borrow(int days, Date date, Member member, Book book) {
1819

1920
public Borrow() {
2021
this.days = 5;
21-
this.date = new Date();
22+
this.date = new GregorianCalendar();
2223
this.member = new Member();
2324
this.book = new Book();
2425
member.borrowBook(this.book, this.date, 1);

src/app/Member.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package app;
22

33
import java.util.Date;
4+
import java.util.GregorianCalendar;
45

56
class Member {
6-
private String id;
7+
private int id;
78
private String name;
89
private int bookLimit;
910
private int bookOut;
@@ -12,7 +13,7 @@ class Member {
1213
private String address;
1314

1415
public Member() {
15-
this.id = null;
16+
this.id = 0;
1617
this.name = null;
1718
this.bookLimit = 3;
1819
this.bookOut = 0;
@@ -21,7 +22,7 @@ public Member() {
2122
this.address = null;
2223
}
2324

24-
public Member(String id, String name, int bookLimit, int bookOut, int age, String phone, String address) {
25+
public Member(int id, String name, int bookLimit, int bookOut, int age, String phone, String address) {
2526
this.id = id;
2627
this.name = name;
2728
this.bookLimit = bookLimit;
@@ -31,7 +32,7 @@ public Member(String id, String name, int bookLimit, int bookOut, int age, Strin
3132
this.address = address;
3233
}
3334

34-
public boolean borrowBook(Book book, Date date, int amount) {
35+
public boolean borrowBook(Book book, GregorianCalendar date, int amount) {
3536
if (this.bookOut >= this.bookLimit) {
3637
System.out.println("limit of " + this.bookLimit + " passed");
3738
return false;

0 commit comments

Comments
 (0)