In: Computer Science
This exercise just lets you focus on data types, statements, etc. in C# to ease you into the language. This
exercise is designed to allow you to focus on the data types
that are appropriate for attributes of real-
world objects. Later, you will start to combine these attributes
with behaviors (methods) and then
transition them into object-oriented classes.
Also, this exercise does not give explicit instructions on every
field required. You will be required to
think through the attributes of these "objects" as you create the
necessary data to support them in an
application.
Create a C# Console application. Within the Main() method in this
application, create variables of the
correct data type for the following:
• Student information, such as:
o First Name
o Last Name
o Birthdate
o Address Line 1
o Address Line 2
o City
o State/Province
o Zip/Postal
o Country
o Any other pertinent information you want to add for a student
record
• Professor information with pertinent fields related to what a
professor in real-life would have.
• A university degree with pertinent fields such as Bachelor or
Master.
o A degree can be Bachelor of Science in Information Technology and
include fields such as
Degree Name, credits required, etc. Some of the fields, such as
course list and prerequisites
will need to wait until you know how to create arrays or
collections.
• A university program with pertinent fields. Fields might
include:
o Program name (examples might be Business, Information
Technology)
o Degrees offered (Bachelor, Master, Ph.D.)
o Department Head
• Information for a course that would be part of your selected
degree and program, with pertinent
fields. Examples might be "Introduction to Computer Science" or
"Introduction to Psychology".
Once you have the variables created, use assignment statements
to assign values to them and use the
Console.WriteLine() method to output the values to the console
window.
Challenge
Investigate the .NET Framework documenation around
Console.ReadLine() and modify your code to use
this method for accepting input from a user of your application and
assign it to the variables you have
created.
Note : VARIABLES have taken as per given constarints but theri data type can be changed by as per your convinience.
Also, i have provided the code for taking inputs for some varibales as well, you can learn from there and your chllenge gets completed.
Aslo, try to play with the code in any IDE, so that you cna interact wit the code.
using System.IO;
using System;
class Student
{
static void Main()
{
string firstName = "Micahel";
string lastName="Douglas";
string birthDate="4/12/1909";
string addressLine1="street 456, lane 4, near buckingam
palace";
string addressLine2="NA";
string city="London";
string state_OR_Province="London";
string zip_OR_Postal="45672";
string country="UK";
Console.WriteLine("Student Details are as follows ");
Console.WriteLine(" LasstName " +lastName);
Console.WriteLine(" birthDate " +birthDate);
Console.WriteLine(" addressLine1 " +addressLine1);
Console.WriteLine(" addressLine2 " +addressLine2);
Console.WriteLine(" city" +city);
Console.WriteLine(" state/Province " +state_OR_Province);
Console.WriteLine(" zip/Postal " +zip_OR_Postal);
Console.WriteLine(" country " +country);
string professorName = "Mr.Nicolas";
string professorCourse ="Physics";
Console.WriteLine("Professor Details are as follows ");
Console.WriteLine(" professorName " +professorName);
Console.WriteLine(" Professor COurse " +professorCourse);
string universityName ="Cambridge";
float credits =100;
string programName ="Computer Science and Technology";
string degrees_offered ="Bachelor/Master/Phd";
string department_head ="Dr. Reddy";
Console.WriteLine("University Details are as follows ");
Console.WriteLine(" university Name " +universityName);
Console.WriteLine(" credits required " +credits);
Console.WriteLine(" program Name " +programName);
Console.WriteLine("Degrees Offered " +degrees_offered);
Console.WriteLine(" department head " +department_head);
string courseTaken ="Introduction to Computer Science";
Console.WriteLine(" course Taken " +courseTaken);
Console.WriteLine("Please enter Student details");
Console.WriteLine(" LasstName ");
lastName = Console.ReadLine();
Console.WriteLine(" birthDate " );
birthDate = Console.ReadLine();
Console.WriteLine(" addressLine1 " );
addressLine1 = Console.ReadLine();
Console.WriteLine(" addressLine2 " );
addressLine2 = Console.ReadLine();
Console.WriteLine(" city" );
city = Console.ReadLine();
Console.WriteLine(" state/Province " );
state_OR_Province = Console.ReadLine();
Console.WriteLine(" zip/Postal " );
country = Console.ReadLine();
Console.WriteLine(" country " );
country = Console.ReadLine();
Console.WriteLine(" Student details entered by you are");
}
}
HOPE I have helped you.
HAPPY Learning.