Am I doing this right?

Hello, this assignment is confusing me very much, the basis for it has been done but I don't know if I have a certain section done correctly... This here is the overview
No description
11 Replies
NovaSprite (AppleCyder)
These are the instructions:
NovaSprite (AppleCyder)
This is what has been done so far, I'm wondering if I am on the right path concerning the class TimeSheetEntry. Especially where I have the days of the weeks listed
using System;

namespace UserInterface
{

class Employee
{
// Attributes
private string name;
private string supervisorName;
// Constructor
public Employee(string name, string supervisorName)
{
this.name = name;
this.supervisorName = supervisorName;
}
// Methods to set and get employee name and supervisor name
public void SetName(string name)
{
this.name = name;
}
public string GetName()
{
return name;
}
// Similarly, define methods to set and get supervisor name
public void SetsupervisorName(string supeervisorName)
{
this.supervisorName = supervisorName;
}
public string GetsupervisorName()
{
return supervisorName;
}

}
class TimeSheetEntry
{
// Attributes
// Define attributes and methods similar to Employee class for TimeSheetEntry
private string Sun;
private string Mon;
private string Tues;
private string Wed;
private string Thurs;
private string Fri;
private string Sat;

// Constructor, methods for adding hours, marking days, validation, and calculating total hours
public TimeSheetEntry(string Sun, string Mon, string Tues, string Wed, string Thurs, string Fri, string Sat)
{
this.Sun = Sun;
this.Mon = Mon;
this.Tues = Tues;
this.Wed = Wed;
this.Thurs = Thurs;
this.Fri = Fri;
this.Sat = Sat;

}
}
class PayrollCalculator
{
// Methods to calculate regular and overtime pay, generate payroll information
}
using System;

namespace UserInterface
{

class Employee
{
// Attributes
private string name;
private string supervisorName;
// Constructor
public Employee(string name, string supervisorName)
{
this.name = name;
this.supervisorName = supervisorName;
}
// Methods to set and get employee name and supervisor name
public void SetName(string name)
{
this.name = name;
}
public string GetName()
{
return name;
}
// Similarly, define methods to set and get supervisor name
public void SetsupervisorName(string supeervisorName)
{
this.supervisorName = supervisorName;
}
public string GetsupervisorName()
{
return supervisorName;
}

}
class TimeSheetEntry
{
// Attributes
// Define attributes and methods similar to Employee class for TimeSheetEntry
private string Sun;
private string Mon;
private string Tues;
private string Wed;
private string Thurs;
private string Fri;
private string Sat;

// Constructor, methods for adding hours, marking days, validation, and calculating total hours
public TimeSheetEntry(string Sun, string Mon, string Tues, string Wed, string Thurs, string Fri, string Sat)
{
this.Sun = Sun;
this.Mon = Mon;
this.Tues = Tues;
this.Wed = Wed;
this.Thurs = Thurs;
this.Fri = Fri;
this.Sat = Sat;

}
}
class PayrollCalculator
{
// Methods to calculate regular and overtime pay, generate payroll information
}
Is the TimeSheetEntry good so far or am I way off?
SG97
SG972mo ago
a few sidenotes, generally I don't use manual set/get methods, just use autoproperties and second, the TimeSheetEntry looks a bit odd considering the user will input their daily hours every day. Edit: nevermind, assignment mentions "weekly" I just shuffled through the assignment, but it feels odd to input every day of the week when you're inputting on Monday for example
NovaSprite (AppleCyder)
I don't know what autoproperties are, I hardly understand get/set methods so I'm just gonna stick to what I'm familiar with So should I put things like "Week 1" instead?
SG97
SG972mo ago
Auto-Implemented Properties - C# Programming Guide - C#
For an auto-implemented property in C#, the compiler creates a private, anonymous backing field accessed only through get and set accessors of the property.
SG97
SG972mo ago
and as such, no GetName / SetName is needed as you can just reference the Name itself the current implementation is ok as is
NovaSprite (AppleCyder)
Ok thank you