Good day gentlement and ladies. I need help concerning how to build a menu for selecting from a list of choices. let's say for example that I want the user to select to a minimum of 4 choices,if they only want two the should select 2 and press a certain key to move on to the next phase of my program. What code should i write or pseudocode do you suggest for this operation? I am thinking of using a case Switch statement embedded in a For Loop. is this assumption Correct? Thank you for your time and attention.

here is the code I am working on so far:

using system;

namespace Student_application{

class student {
private string first_name,last_name;
private int age,Year_of_Birth;

public student(){

string first_name;
string last_name;
int age;
int Year_of_Birth;

}

// public method in student class to get student information
public void getstudentinfo()
{
 Console.Writeline("What is your name,age,year of birth?");
 first_name=Console.Readline();
 last_name=Console.Readline();
 age=ConvertToInt32(Console.ReadLine());
 Year_of_Birth=ConvertToInt32(Console.ReadLine());

}
}

// Demonstration of class inheritance by course being a derived class of student
// public method to input courses
class Course:student{
private string course1,course2,course3,course4;
private int Number_of_Courses;

public Course(){
    int Number_of_Courses[];
    }

public Course_modify(){
    get{ return Number_of_Courses;}
    set{ Number_of_Courses=value;}
}

public void Course_selection(){

Console.Writeline(" Welcome",{0} {1} first_name,last_name);
Console.Writeline("Input a minimum of 4 courses you wish to pursue for this semester. press x when you are finished with your selection.")
Number_of_Courses=ConvertToInt32(Console.ReadLine());
course1=Console.Readline();
course2=Console.Readline();
course3=Console.Readline();
course4=Console.Readline();

}

}

class fee_details:Course{
private const double course_cost=500.34;
private const double exam_fee=230.34;
private const double library_fee=110.12;

if 

}

Recommended Answers

All 2 Replies

I would suggest a List<Course> of a separate class for Course. This should only have the information about a single course including a List<Student> of those students registered to that course, the name of the course, a description, a max capacity and a current count.

By the way, since Course really has no similarity to an individual student, it really doesn't make any sense for it to inherit from student. If you must have an example of inheritance, a class Person could have a student class, a professor class and an administrator class all inheriting fromPerson, with Person containing those properties common to all persons,name,address,age,etc.

Your menu can list the courses available and a while loop would work for the user to choose the courses. I would suggest refreshing the display to show the courses selected and have options to un-select a course as well as save their choices.

Once the choices are confirmed a list of courses can be added to that student's info and each course can have its list of students updated.

When you are done, each course will have a list of students registered to that course and each student will have a list of courses they have registered with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.