C
C#•2d ago
'brella boy

i have 44 errors that I don't know how to fix

I seriously don't know what I'm doing wrong my program only has 106 lines
96 Replies
'brella boy
'brella boyOP•2d ago
No description
'brella boy
'brella boyOP•2d ago
No description
'brella boy
'brella boyOP•2d ago
No description
'brella boy
'brella boyOP•2d ago
No description
'brella boy
'brella boyOP•2d ago
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Keswiik
Keswiik•2d ago
look at lines 27 and 28 of your first image
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Keswiik
Keswiik•2d ago
you have statements outside of any method body actually those might be fine, misread
MODiX
MODiX•2d ago
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
oops sorry
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
uhhh
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
how do i do that oh
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
idk what to do past this point truthfully
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Keswiik
Keswiik•2d ago
^ although i think i misread his class, thought he was trying to re-assign the declared x and y fields but i had to zoom in a bit lol
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
oops i was looking at the wrong thing
'brella boy
'brella boyOP•2d ago
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
edit it in visual studio?
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
it has some red now
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
hold on
'brella boy
'brella boyOP•2d ago
No description
No description
No description
'brella boy
'brella boyOP•2d ago
did it rollback some of my code.. doesnt matter it didnt change anything of importance but im down to 25 errors! yay!
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
really? half of this isnt mine i was given a template to fill out well that part WAS mine i just didnt know how to make a setter other than through that
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
i know what its doing i just have 0 clue how to fix the errors like i know syntax even if im ass at programming
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
that errors gone now i did change the name tbf to myself i just didnt see that error the errors now are
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
a whole lot of these
No description
'brella boy
'brella boyOP•2d ago
nope truthfully idk how to fix those
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
no i do get that theyre both set to 0 atm but like heres where the template issue comes in template says:
'brella boy
'brella boyOP•2d ago
No description
'brella boy
'brella boyOP•2d ago
so I assume its supposed to look like that so I guess more accurately I SHOULD say that idk how to fix it but keep in line with the template?
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
i swear i changed it
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
its the template i copied it into vs then started editing
Jimmacle
Jimmacle•2d ago
i suspect you copied something twice instead of once
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
my school
Jimmacle
Jimmacle•2d ago
all the errors indicate lots of duplicate things in your code
'brella boy
'brella boyOP•2d ago
my teacher set a task there was a duplicate oops ill delete it
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
ya ty for this
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
im down to 12 errors
'brella boy
'brella boyOP•2d ago
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
idk why THIS is here because i put semicolons at 39
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX•2d ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
...
No description
'brella boy
'brella boyOP•2d ago
cant even copy it here
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
all the codes errors are within these lines though
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
i did something wrong?
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
mk thats what im trying to do 😭 i just have a lot of work to do 24/7
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
yeah i got
'brella boy
'brella boyOP•2d ago
No description
'brella boy
'brella boyOP•2d ago
instead
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Jimmacle
Jimmacle•2d ago
then you still have () somewhere you shouldn't check the lines the errors mention
'brella boy
'brella boyOP•2d ago
using System;
// for ListOf
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;

public class Program
{

// Actor in the game
class Actor
{
protected String _name; // can be accessed by the subclasses
protected int x; // x cordinate
protected int y; // y cordinate

// Constructor
public Actor(String n)
{
_name = n;
x = 0; // initialise cordinates
y = 0;
}

// getter to get the coordinates of the object

int inputForY = Convert.ToInt32(Console.ReadLine());
int inputForX = Convert.ToInt32(Console.ReadLine());

public int Y
{
get { return y; }
set { y = inputForY; }
}

public int X
{
get { return x; }
set { x = inputForX; }
}


public (int, int) getCordinates()
{
return (x, y);

}
// draw( )method.
// Derived classes may provide an implementation
public virtual void draw()
{
Console.WriteLine("Actor {0}: Base draw() method for an actor", _name);
}

}

// Archer class.
// Attributes: bowLength
// Method: implement the draw() method to override
// the implementation the base class
class Archer : Actor
{
private int bowLength;

// Constructor for Archer.
// Call the constructor for Actor using the name
public Archer(String name, int b) : base(name)
{
bowLength = b;
}
public override void draw()
{
Console.WriteLine("Archer: {0} with bowlength {1}", this._name, bowLength);
}

public void getX()
{
X();
Console.WriteLine("x is " + x);
}

public void getY()
{
Y();
Console.WriteLine("y is " + y);
}
}


public static void Main(string[] args)
{


// Create a list of Actor object
List<Actor> actorList = new List<Actor>();

// Add instances of Actor objects to the actorList
actorList.Add(new Actor("Ian McEwan"));
actorList.Add(new Archer("Legolas", 120));

// Iterate through the list of actors and call the
// call the draw method for each one
foreach (var a in actorList)
{
a.draw(); // draw the actor


}
}
}
using System;
// for ListOf
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;

public class Program
{

// Actor in the game
class Actor
{
protected String _name; // can be accessed by the subclasses
protected int x; // x cordinate
protected int y; // y cordinate

// Constructor
public Actor(String n)
{
_name = n;
x = 0; // initialise cordinates
y = 0;
}

// getter to get the coordinates of the object

int inputForY = Convert.ToInt32(Console.ReadLine());
int inputForX = Convert.ToInt32(Console.ReadLine());

public int Y
{
get { return y; }
set { y = inputForY; }
}

public int X
{
get { return x; }
set { x = inputForX; }
}


public (int, int) getCordinates()
{
return (x, y);

}
// draw( )method.
// Derived classes may provide an implementation
public virtual void draw()
{
Console.WriteLine("Actor {0}: Base draw() method for an actor", _name);
}

}

// Archer class.
// Attributes: bowLength
// Method: implement the draw() method to override
// the implementation the base class
class Archer : Actor
{
private int bowLength;

// Constructor for Archer.
// Call the constructor for Actor using the name
public Archer(String name, int b) : base(name)
{
bowLength = b;
}
public override void draw()
{
Console.WriteLine("Archer: {0} with bowlength {1}", this._name, bowLength);
}

public void getX()
{
X();
Console.WriteLine("x is " + x);
}

public void getY()
{
Y();
Console.WriteLine("y is " + y);
}
}


public static void Main(string[] args)
{


// Create a list of Actor object
List<Actor> actorList = new List<Actor>();

// Add instances of Actor objects to the actorList
actorList.Add(new Actor("Ian McEwan"));
actorList.Add(new Archer("Legolas", 120));

// Iterate through the list of actors and call the
// call the draw method for each one
foreach (var a in actorList)
{
a.draw(); // draw the actor


}
}
}
oh wait no lines oops uhhh ill just send screenshots
Jimmacle
Jimmacle•2d ago
public void getX()
{
X();
Console.WriteLine("x is " + x);
}

public void getY()
{
Y();
Console.WriteLine("y is " + y);
}
public void getX()
{
X();
Console.WriteLine("x is " + x);
}

public void getY()
{
Y();
Console.WriteLine("y is " + y);
}
these are wrong
'brella boy
'brella boyOP•2d ago
i swear i just removed that wtf oh more of them
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
but now i just get
No description
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
mk
Unknown User
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
'brella boy
'brella boyOP•2d ago
ill try this alr gn yeah it didnt work but im gonna try and learn off chatgpt
Jimmacle
Jimmacle•2d ago
bad idea chatgpt can and will be wrong and you aren't experienced enough to tell the difference
Buddy
Buddy•2d ago
Please don't use ChatGPT. It won't make you learn and you will only blindly copy off of it from what I have seen when people use it.
Unknown User
Unknown User•18h ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX•18h ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server