I have done everything but output screenshot and requirement not matching ..
Any ideas ? am i doing wrong .
Create a class representing a student. Include chaarcteristics such as student number, first and last name, overall GPA, classification, and major. Write at least two constructors. Include properties for each of the data items. Create a second class that instantiates the first class with information about yourself. In the second class, create a class method that displays your name and GPA.
Sample output: http://i.imgur.com/Ro5xsu8.png
Regards

VulpesPosted Feb 19, 2014, 4:20 PM
Can I point out a problem with your student class as it currently stands.
If you're using 'automatic' properties (i.e. get; set; ), then you don't want to define the backing fields yourself.
That's because an automatic property generates its own backing field even though it's hidden from view and can only be accessed via the property.
You should, of course, only use automatic properties if you don't plan to do any validation. If you do plan to validate the values, then you should use 'traditional' properties instead and will then need to define the associated backing fields yourself.
SUNIL GUTTAPosted Feb 19, 2014, 3:28 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace part1
{
class student
{
int _student_number;
string _first_name ;
string _last_name;
double _overall_GPA ;
string _classification ;
string _major;
public int student_number
{ get; set; }
public string first_name
{ get; set; }
public string last_name
{ get; set; }
public double overall_gpa
{ get; set; }
public string classification
{ get; set; }
public string major
{ get; set; }
public student(int student_number,string first_name,string last_name, double overall_gpa, string classification, string major )
{
_student_number = student_number;
_first_name=first_name;
_last_name=last_name;
_overall_GPA=overall_gpa;
_classification=classification;
_major=major;
}
public student()
{
_student_number = 0;
_first_name="";
_last_name="";
_overall_GPA=0.0;
_classification="";
_major="";
}
}
}
STUDENT_TEST.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace part1
{
class student_test
{
static void Main()
{
student obj = new student();
string keyplease; int s1;int count=1;string s2,s3,s5,s6; double s4;
Console.WriteLine(" First Test ");
do
{
if (count >1)
{
Console.WriteLine(" ");
Console.WriteLine(" Another Test ");
}
count += 1;
Console.WriteLine(" ");
Console.Write("Enter student number : ");
s1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter First Name : ");
s2 = Console.ReadLine();
Console.Write("Enter Last Name : ");
s3 = Console.ReadLine();
Console.Write("Enter Overall GPA : ");
s4 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter classification : ");
s5 = Console.ReadLine();
Console.Write("Enter Major : ");
s6 = Console.ReadLine();
Console.WriteLine("");
Console.Write("Enter q to continue or anyother key to quit : ");
keyplease = Console.ReadLine();
Console.WriteLine("");
}
while (keyplease != "q");
student std = new student(s1, s2, s3, s4, s5, s6);
Console.ReadKey();
}
}
}
Joginder BangerPosted Feb 19, 2014, 2:38 PM