Should getters and setters be used for every bit of data you get from a user?
If I have a questionnaire getting data from a user
should getters and setters always be used to get/set information like a name address age etc etc
i understand what they are? just dont know their relevance and how...
I have a questionnaire that gets info from the user
it asks a question like name etc then asks if hes satisfied with the name
then after all the questions it gives a summary of data supplied and then asks if its ok to proceed
if the user presses y it exits that part of the program
if n it hits...
Does anybody know where there are any good exercises for beginners
im not talking about quick exercises but more word problem ones that are more like mini projects
something like an address book or something similar, cant seem to find any.
Cant someone suggest some, and then us beginners can...
Hi guys
If I have a Program class with main
and i have a Team class
And in the Team class I have fields
teamName
teamValue
then in Team i want methods
CreateTeam
DeleteTeam
AddTeamValue
ViewTeams
now I know in the constructor in my Program class I can go
Team liverpool = new Team(4.5); -...
this works very well,
is it true to say if a bool is false, but then gets a value that it becomes true?
Somebody answered me something similar in another thread, but i just wanted to make sure.
bool hasName = false;
while (!hasName)
{...
If im going to make a menu for my utility
should i have a non static method to print the menu
and a static method to handle the logic?
or would you just put it all in one method, or does it not really matter?
This method asks for a string between min and max characters
and then asks for confirmation on entering a valid string
please let me know if it can be done more efficiently etc etc
public static string GetLimitedStringWithConfirmation(string prompt, int min, int max)
{
do
{...
in this method
public static string GetLimitedString(string prompt, int min, int max)
{
string userString;
bool hasAString = false;
do
{
Console.WriteLine(prompt);
userString = Console.ReadLine();
if (userString.Length >= min && userString.Length <= max)...
I thought it might be a good idea to have a class that handles all the keyboard stuff so i dont have to keep writing input code over and over i mean thats one of the pros i read about OOP, reusable code.
I have created a Class called KeyboardUtility and I have it returning number only input...
How can I exit my loop in the main program when the user enters q?
whats the best way to set this up?
i have this class
using System;
namespace HourlyMeetingScheduler
{
class Program
{
static void Main(string[] args)
{
bool programRunning = true...
in this method,
why cant i use a char in my switch?
public void MainMenuLogic()
{
string userChoice = Console.ReadLine();
char firstLetter = userChoice[0];
switch (firstLetter)
{
case "a": {...
Just doing an exercise,
Adding numbers to an array and then sorting the list.
im trying to determine if input from a user is a number or a letter for my options, but i think im over complicating it.
Am i on the right track here or is there an easy way to do this?
The problem im having is...
Hello guys,
cant remember if really newb questions go here.
anyway, i am writing a basic times table program
asks the user for number between 1 and 12 then spits out that numbers times table, but im having a problem, why cant number be carried through the do while loop?
i would have thought...
if i wanted a user to enter a mobile number in a console application
so the user can only input
011 086 087 to start and then 7 digits after that
so as in 0142223434
would it be best done with regular expressions? or is there a better way?
sorry guys
didnt know where to post this..
what do i need to know to create a back end for web apps made with html css javascript.
is there a free solution?
it will be basically for study, nothing too elaborate but something that can scale with time. Basically what companies are using.
any...
Hi guys,
I just cant work out why my program is behaving differently to the tutorial im following, i have checked the code again and again (Though i bet you its something stupid i missed, usually is)
the problem im having, where his program is different is that after he creates a new car...
Hello all,
im new here. Is this where beginners can ask stupid c# questions? or is there another section somewhere?
i will post now and im sure it can get moved to the relevant location if this isnt it.
anyway following a app tutorial on youtube, loving it.
but in the code:
to take this...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.