using System;
namespace studentObj
class Student
{
private int id ();
private string name ();
private char grade ();
public int ID
{
get {return id;}
}
public string Name
{
get {return name;}
set {name = value;}
}
public char Grade
{
get {return grade;}
}
public Student(int ID, string Name)
{
int id;
string name;
}
public SetGrade(float score)
{
if (score>=90.0f)
grade="A";
else if (score>=80.0f)
grade="B";
else if (score>=70.0f)
grade="C";
else if (score>=60.0f)
grade="D";
else
grade='F';
return grade;
}
public override string ToString(){
}
class Kid
{
private int id { get; }
private string name { get; set;}
private char grade { get; }
public override string ToString ()
{
return id + "," + name + "," + grade;
}
}
}
class MainClass
{
public static void Main (string[] args)
{
Student student = new Student (Name = "Jasdeep", ID = "234");
SetGrade.student=75.0f;
Console.WriteLine (student);
}
}
}
Jasdeep11 0 Newbie Poster
Recommended Answers
Jump to PostSo... you just post some code... now what? Nobody here can read your mind to know what problems you are having with this code.
Explain your self! At least say what you're trying to do and where you are stuck at.By the way, you are missing an '{' after …
Jump to PostOh, ok. Should be like this:
public string SetGrade(float score) { if (score>=90.0f) grade="A"; else if (score>=80.0f) grade="B"; else if (score>=70.0f) grade="C"; else if (score>=60.0f) grade="D"; else grade='F'; return grade; }
All 5 Replies
AleMonteiro 238 Can I pick my title?
Jasdeep11 0 Newbie Poster
overwraith 83 Newbie Poster
AleMonteiro 238 Can I pick my title?
overwraith 83 Newbie Poster
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.