Create a console application for the department to record information for students who receive bursaries in the department. For each recipient you need to store the recipient’s name and the number of hours outstanding. Most new recipients start with 90 hours, but there are some exceptions. As recipients works in the department, the number of hours left needs to be updated (decreased) from time to time, based on hours already worked. Implement class Recipient which has private attributes for Name and Hours. Create two constructors, one with a default allocation of 90 hours for a recipient, and the other should accept the number of hours for a recipient. In addition to the constructors, the class should have the following methods: public string getName() //Returns the name of the recipient public int getHours() //Returns the hours outstanding public void setHours(int H) //Set the hours outstanding public void displayRecipient() //Display the name and number of hours left for a recipient
using System;
using System.Collections.Generic;
namespace RecipientApp
{
class Recipient
{
private string Name;
private int Hours;
public Recipient(string name)
{
this.Name = name;
this.Hours = 90;
}
public Recipient(string name, int рours)
{
this.Name = name;
this.Hours = рours;
}
public void setHours(int Н)
{
this.Hours = Н;
}
public string getName()
{
return Name;
}
public int getHours()
{
return Hours;
}
public void displayRecipient()
{
Console.WriteLine("Name: " + Name + "\n" + "Hours: " + Hours + "\n");
}
}
class Program
{
static void Main(string[] args)
{
Console.ReadLine();
}
}
}
Comments
Leave a comment