-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cs
92 lines (76 loc) · 2.4 KB
/
main.cs
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Collections;
class RecordCollection {
string albumName, artist, genre, format;
int releaseYear, discNum;
//creating arraylist
static ArrayList records = new ArrayList();
//constructor
public RecordCollection(string albName, string art, string gnr, string fmt, int year, int discNo){
albumName = albName;
artist = art;
genre = gnr;
format = fmt;
releaseYear = year;
discNum = discNo;
}
//ToString override method:
public override string ToString(){
return "\nAlbum name: " + albumName + "\nArtist: " + artist + "\nGenre: " + genre + "\nFormat: " + format + "\nRelease Year: " + releaseYear + "\nNumber of Discs: " + discNum;
}
//enter username and be greeted
public static void enterUserName(){
Console.WriteLine("Enter username:");
string userName = Console.ReadLine();
Console.WriteLine("Hello " + userName + "!");
}
//brings up the main menu
public static void Menu(){
Console.WriteLine("What would you like to do? \nView Collection Add to Collection Remove from Collection Quit");
string cmmd = Console.ReadLine();
if (cmmd.ToLower().Equals("view collection")){
Console.WriteLine("View Collection.");
ViewCollection(records);
}
else if (cmmd.ToLower().Equals("add to collection")){
Console.WriteLine("Add to Collection.");
}
else if (cmmd.ToLower().Equals("remove from collection")){
Console.WriteLine("Remove from Collection.");
}
else if (cmmd.ToLower().Equals("quit")){
Console.WriteLine("Quit.");
System.Environment.Exit(0);
}
else {
Console.WriteLine("Command not found.");
Menu();
}
}
public void addRecord(RecordCollection record){
records.Add(record);
}
public static void ViewCollection(ArrayList list)
{
Console.WriteLine("\nYour Record Collection:");
foreach (var each in list){
Console.Write(each + "\n");
}
}
//from menu
public static void AddToCollection(){
}
//from menu
public static void RemoveFromCollection(){
}
public static void Main (string[] args) {
//creation of object:
RecordCollection cd1 = new RecordCollection("Automatic for the People", "REM", "Alternative", "Cassette", 1992, 1);
RecordCollection cd2 = new RecordCollection("Queen II", "Queen", "Rock", "Cassette", 1974, 1);
//system order instructions
enterUserName();
cd1.addRecord(cd1);
cd2.addRecord(cd2);
Menu();
}
}