-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStudent.cs
More file actions
57 lines (50 loc) · 1.5 KB
/
Student.cs
File metadata and controls
57 lines (50 loc) · 1.5 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
using System;
using System.Collections;
public class Student {
Guid guid = Guid.NewGuid();
string id = guid.ToString();
private Student student;
//private final long studentId;
ArrayList<Checkout> transactionHistory = new ArrayList<>();
ArrayList<UUID> studentT=new ArrayList<>();
// function to generates random 9 digit student id
Student() {
Random rand = new Random(100);
int code= rand.Next(000000000, 999999999);
}
public string getStudentId(){
return sid;
}
// add item with given code and qty to the student's cart
public void addItemToCart(String code, double qty){
cart.put(code, qty);
}
// Display complete Checkout History
public void displayCheckoutHistory()
{
for (Checkout check : transactionHistory) {
check.displayCheckoutInfo();
}
}
// return rented item
public void returnRentedItem(String code, double qty){
Checkout check = new Checkout();
check.returnItem(code, qty);
}
}
// Get info about all items in the student's cart
public ArrayList<keyvaluepair<String, Double>> getCartInfo(){
int count = 1;
for (studentT<String, Double> item : cart.entrySet()) {
Console.WriteLine("-----------------------------------");
Console.WriteLine("-----Details about the inventory Info-----");
Console.WriteLine("");
Console.WriteLine(count);
Console.WriteLine("");
Console.WriteLine(count);
Console.WriteLine(item.getKey());
Console.WriteLine(item.getValue());
count++;
}
return cart;
}