66 888
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #25935 in C# for ISAA

Question #25935
Write a C # console application which contains two classes:
1. The first class “person” contain 4 attributes:
* PersonId which is a private integer.
* Name and Graduation which are public string.
* Age which is a public integer.
And a public method “PersonnalInformation()”. The method should include commands that read the input values for each of the attributes above and then print the input values.
Expert's answer
Class Person
using System;

namespace Question_25935
{
public class Person
{
& /// <summary>
& /// Default constructor
& /// </summary>
& public Person()
& {
& }

& private int PersonId; &
& public string Name;
& public string Graduation;
& public int Age;
&
& public string PersonnalInformation(int id, string name, string graduation, int age)
& {
PersonId = id;
Name = name;
Graduation = graduation;
Age = age;
return string.Format("Person: {0}, Name: {1}, Graduation: {2}, Age: {3}", PersonId, Name, Graduation, Age);
& } &
}
}



Class Main
using System;

namespace Question_25935
{
class Program
{
& public static void Main(string[] args)
& {
Person person = new Person(); //Create object

Console.Write("Enter value of Person Id: ");
var id = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter value of Name: ");
var name = Console.ReadLine();
Console.Write("Enter value of Graduation: ");
var graduation = Console.ReadLine();
Console.Write("Enter value of Age: ");
var age = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(person.PersonnalInformation(id, name, graduation, age));
Console.WriteLine();
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions