C
C#•3w ago
cone

College project

I have this project that's due in quite soon but ANY help is greatly appreciated considering i'm not too sure where to start. I have a file with all the cards on so that bit is done for me but the rest is a bit challenging for me.
No description
No description
158 Replies
Buddy
Buddy•3w ago
if you need GUI, then Windows Forms Application .. If not, make a simple console application As simple as that
Pobiega
Pobiega•3w ago
So just to clarify, you have not even started so far?
canton7
canton7•3w ago
That looks like a console application should be fine, IMO
Angius
Angius•3w ago
I concur, starting with a console application would be good
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yep, it should be pretty simple to implement it as a console application, I can help you if you want, but I would need the code provided to you by your teacher to give u a small beta and show you how I started to be fair it sounds like a project which takes 1-2 hours if it is an console application
cone
coneOP•3w ago
I started it but not finished, it's due in on monday but i doubt he'll even check
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
c# or which language
cone
coneOP•3w ago
i scrapped the code he gave me and started it by myself, i can show you what ive done so far yes, C#
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
thats fine, I always do that xD nice
cone
coneOP•3w ago
should i send a screen shot or copy and paste
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
would be great, but dont need to, I just need the data for the dog cards How you think its best
cone
coneOP•3w ago
alright be back in a sec then
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
np
cone
coneOP•3w ago
okay so these are the dog cards (dogsdata.txt): Annie the Afgan Hound,1,4,7,9 Bertie the Boxer,6,7,7,10 Betty the Borzoi,5,4,10,9 Charlie the Chihuahua,7,9,7,10 Chaz the Cocker Spaniel,9,8,2,1 Donald the Dalmatian,10,2,6,3 Dottie the Doberman,8,9,6,3 Fern the Fox Terrier,3,1,8,6 Frank the French Bulldog,4,7,8,6 George the Great Dane,3,3,7,4 Gertie the Greyhound,10,1,2,1 Harry the Harrier,3,6,1,1 Ian the Irish Wolfhound,4,1,1,1 Juno the Jack Russell,9,7,8,2 Keith the Kerry Blue,9,1,10,6 Larry the Labrador,8,2,6,2 Marge the Maltese,4,6,9,2 Max the Mutt,3,10,10,1 Nutty the Newfoundland,7,7,10,8 Olive the Old English Sheepdog,6,9,5,6 Peter the Pug,10,3,10,1 Poppy the Pekingese,10,3,5,9 Rosie the Rottweiler,10,7,9,7 Ruby the Retriever,1,8,4,5 Sam the Springer Spaniel,3,6,7,7 Sukie the Saluki,7,3,8,9 Vernon the Vizsla,7,10,5,2 Whilma the West Highland Terrier,1,5,7,7 William the Whippet,7,9,7,9 Yolande the Yorkshire Terrier,4,5,5,4
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
okay
cone
coneOP•3w ago
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Program { // Reads in a list of dogs // IMPORTANT: // The file "dogsdata.txt" MUST be saved in the same folder // as this program static List<string[]> ReadInList() { var theList = new List<string[]>(); // Read the file "dogsdata.txt" using (var reader = new StreamReader("dogsdata.txt")) { while (!reader.EndOfStream) { var line = reader.ReadLine(); if (line != null) { var values = line.Split(','); // Assumes the file is comma-separated theList.Add(values); } } } return theList; } // Use this for testing that the full list is imported static void PrintList(List<string[]> aList) { foreach (var item in aList) { Console.WriteLine(string.Join(", ", item)); // Joins the array with commas for printing } } // Add your subroutines here // START OF MAIN PROGRAM static void Main(string[] args) { // Read in the list first List<string[]> dogsList = ReadInList(); // Uncomment the next line once you know it works PrintList(dogsList); } } that's the program he gave us t owork off of i looked at it and said fuck that and started my own
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Do we need to give the user the option to shuffle or can we implement it if we want it?
cone
coneOP•3w ago
hmm, dont think so, whatever is written on the page is written he didn't say do anything else nor extra
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Okay thats fine, im close to finish ig I will send it in here then And explain
cone
coneOP•3w ago
yeah i think it's just subroutines and if statements thanks so much, so nice of you lmao
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yeah but if you wanna give the teacher the thinking that you improved (if beginner level) use switch case statements np bro, thats also fun to me xD
cone
coneOP•3w ago
yeah i know switch case but they are so annoying to me for some reason lol i think im pushing intermediate level like just below that id say
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
ik for me too xD ah sorry missed that xD
cone
coneOP•3w ago
Do you have a job in computing or are you still a student
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Nah year 13 student started late in year 12 with computer science when did u start?
cone
coneOP•3w ago
awesome i started doing python in year 10 for computer science in school but in year 12 we learn C# and i love it so i sped aheah of the class but i think they're catching up now lmao, i started learning C# about the end of September
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
nice! I also speeded up at year 12 but there was someone who already did full year 12 in year 11 so I had no chance xD
cone
coneOP•3w ago
Can i send you a friend request, seem like a chill dude lol?
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
np send u one
cone
coneOP•3w ago
yeah my friend has been programming since he was like 9, he is super good at it and nothing else lol, it's crazy what he can do in his free time but only if he put the effort in and leanred the computer science theory he would be an A* student lol
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
lol
cone
coneOP•3w ago
what career do you want to go down? Software engineer?
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yeah theory is the hardest part, I got 96% in practical computer science in both predicted exams but I am on an A due to theory
cone
coneOP•3w ago
bruh i got a D then a C on the recent one i hate the theory or practical bit
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
both? but I need to admit, I was the same at start of y12
cone
coneOP•3w ago
nah both practice exams we do these things called "caps" which is just like a practice exam and my teacher says "On the next cap there will be no programming so you're welcome" and im just so annoyed because programming is the one thing i actually like doing
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
haha that is shit, nah we have one practical and another theory teacher so we learn both and get tested on both
cone
coneOP•3w ago
yeah our actual exams are like that my actual Psychology exam is on Wednesday so i'm not exited for that I'm trying to grow on twitch aswell so that doesn't help
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
oh no xD Nah I streamed for a little bit xD
cone
coneOP•3w ago
what do you stream
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
I would focus on exams this week minecraft bedwars xD
cone
coneOP•3w ago
i gave up on bedwars ages ago are you german? just from ur bio
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yeah i am german (:
cone
coneOP•3w ago
sick ive got a german friend
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
haha
cone
coneOP•3w ago
ill talk later im jst going to eat my lunch brb
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
np see ya finished with coding, now I just need to check if there are any errors in the code
cone
coneOP•3w ago
okay im back That's great! thanks so much
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
np
cone
coneOP•3w ago
ill show u what i've done so far bc why not using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; using System.IO; namespace Actual_dog_game { internal class Program { static void Main(string[] args) { int x = 0; string[,] myarray = new string[30, 5]; string filepath = "C:\Users\euang\Downloads\DogGameFile\dogsdata.txt"; using (StreamReader reader = new StreamReader(filepath)) { string line; while ((line = reader.ReadLine()) != null) { string[] filearray = line.Split(','); myarray[x, 0] = filearray[0]; myarray[x, 1] = filearray[1]; myarray[x, 2] = filearray[2]; myarray[x, 3] = filearray[3]; myarray[x, 4] = filearray[4]; x++; } } Console.Write("----------------\r\n Celebrity Dogs\r\n----------------\r\n\r\nEnter your name: "); string name = Console.ReadLine(); Console.WriteLine($"\nWelcome to Celebrity Dogs, {name}!\n"); Thread.Sleep(1000); Console.Write("Menu:\r\n1 -> Play Game\r\n2 -> View Random Dog Card\r\n3 -> Quit\n\nOption: "); int option = Convert.ToInt32(Console.ReadLine()); bool flag = true; while (flag) { if (option == 1) { } else if (option == 2) { } else if (option == 3) { Console.WriteLine("Quitting game..."); Thread.Sleep(1500); Environment.Exit(0); } }

Console.ReadKey(); } } } that's what i did so far
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
okay interesting wait
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
oh forgot to comment it
cone
coneOP•3w ago
wow thanks this will work in .NET right?
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
should be but it is .net 7.0 because no mac support anymore for vs
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Not the best code but works, found some errors so those should be fixed
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
if u have questions or I should explain it further, just ask (: @cone
cone
coneOP•3w ago
sorry i went and did something ill put in on now
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Nah thats fine xD I think the quit option does work right now but Im in the car so I will fix it later
cone
coneOP•3w ago
my only issue now is the dogsdata.txt it doesn't work for some reason i've put them in the same folder but they dont seem to be working
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Ah okay I could know the issue
cone
coneOP•3w ago
No description
cone
coneOP•3w ago
No description
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
I need to get to my pc, pls give me 1/2 an hour, I will ping you when I sent the fixes solution if that is okay
cone
coneOP•3w ago
yeah that's fine no worries we can even call later if u need to explain
Buddy
Buddy•3w ago
Read the path. It is loading it from a relative path. You should never work with absolute paths unless you absolutely have to Always prefer relative In this case the file must exist in the directory being spat out by the error message Absolute paths meaning C:/Users/YourName/Desktop/Foobar.txt And relative being relative to current working directory. In this case, where the executable is.
cone
coneOP•3w ago
what should i change and how do i do it this hs been the main issue for a while now
Buddy
Buddy•3w ago
Filepath. If you define the path as foobar.txt without specifying a drive letter such as dogs/foobar.txt, that makes it relative.
cone
coneOP•3w ago
so instead of "dogsdata" how will it know to open that text file then
Buddy
Buddy•3w ago
This path is correct, this is relative. This however is absolute
cone
coneOP•3w ago
okay gimmi a minute
Buddy
Buddy•3w ago
So in the case of absolute, there must be a user named euang and must have a folder called DogGameFile and a file inside of that directory called dogsdata.txt And if it's relative, you only need a file called dogsdata.txt in the same path as the executable (by default)
cone
coneOP•3w ago
my only question is why isn't it working then because there IS a user named euang and a folder called DogGameFile and all that, by all means im happy to change absoloutely anythig i just like knowing how and why
Buddy
Buddy•3w ago
You mean this?
cone
coneOP•3w ago
yeah i think
Buddy
Buddy•3w ago
Read the path that it seeks in. It seems like you aren't reading what I explained or you aren't understanding it.
cone
coneOP•3w ago
sorry but i think im not understanding im new to C# and visual studio and suff
Buddy
Buddy•3w ago
Show the path
cone
coneOP•3w ago
No description
cone
coneOP•3w ago
that? LMAO ignore the image at the top of the screenshot there's context
Buddy
Buddy•3w ago
Ok, compare that path to this
cone
coneOP•3w ago
what's the difference between path and location
Buddy
Buddy•3w ago
No description
Buddy
Buddy•3w ago
This is in downloads, while it wants a completely different path / location. No difference
cone
coneOP•3w ago
"C:\Users\euang\Downloads\DogGameFile\dog game with help from german guy.cs" thats my clipboard when i copy the path
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Wait look
cone
coneOP•3w ago
how do i fix it
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
So where have h stores the data with those dogs?
cone
coneOP•3w ago
downloads -> DogGameFile oh shit did that guy leave i think he got sick of it
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
xD
cone
coneOP•3w ago
i genuinely didn't understand what he was on about 😭
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Can u send me a screenshot of the path of the dog data file? 😂
cone
coneOP•3w ago
No description
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Okay, i think i know why Can u open a new Project in vs?
cone
coneOP•3w ago
yes
cone
coneOP•3w ago
No description
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Yup .net framework
cone
coneOP•3w ago
No description
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Then replace the existing code in this project with mine
cone
coneOP•3w ago
okay done
cone
coneOP•3w ago
No description
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Now go to the folder where the new project is stored
cone
coneOP•3w ago
No description
cone
coneOP•3w ago
i called it "temporary"
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Thats fine (: Go in the folder -> bin ->… until u are in the .net … folder and then paste the dog data file in there Or debug
cone
coneOP•3w ago
in bin there's "debug"
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Then paste it in debug (: Macos is little bit different (:
cone
coneOP•3w ago
can i drag and drop
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Yep ig
cone
coneOP•3w ago
okay done should i run the code
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Yep Does it work?
cone
coneOP•3w ago
yes almost everything works, just when the computer runs out of cards this happens
cone
coneOP•3w ago
No description
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
try it with a while loop instead of do while maybe could be a silly mistake on my side no no stop
cone
coneOP•3w ago
i didnt start dw
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
&& instead of ||
cone
coneOP•3w ago
alr
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
in the do while loop okay it works for me
cone
coneOP•3w ago
Sickkk thanks sm
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
no problem
cone
coneOP•3w ago
ive officially completed all my hw now, you helped loads and explained way better than that guy
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Thats great! Thanks xD
cone
coneOP•3w ago
how come Germans are so good at speaking English
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
I am a boarder at a school in england but because those languages are quite similar english is just way easier in grammer etc
cone
coneOP•3w ago
yeah i realised English is a germanic language
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
😄
cone
coneOP•3w ago
yeah i tried learning german but i gave up where are you in the UK?
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
understandable, I woud too xD Cotsworlds u?
cone
coneOP•3w ago
I'm in Manchester
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
nice (:
cone
coneOP•3w ago
not far from u loll
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yep xD
cone
coneOP•3w ago
were you born in germany
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
munich in the south east
cone
coneOP•3w ago
ahh cool my mum has a degree in german she used to live there my friend lives in Hörstel
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
oh thats great!
cone
coneOP•3w ago
i think it's near the netherlands border
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yep just looked it up xD
cone
coneOP•3w ago
her english is so good i dont even understand how or why
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
haha
cone
coneOP•3w ago
alright im gonna revise now, ill message u again if i need anything or have a problem thanks!
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
yes sure!
cone
coneOP•3w ago
hang on
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
np i loveit to help others
cone
coneOP•3w ago
sometimes my code goes white? like the word "Console" it goes white and its all colourless how could i fix that
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Hmm I also had that sometimes hang on When you have that go: Tools > Options > Text Editor > C# > Advanced and select "Visual Studio 2019" in the Editor Color Scheme dropdown that should fix it
cone
coneOP•3w ago
yeah okay, it's not happened currently but ill do it if it happens again
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
Okay (:
cone
coneOP•3w ago
also, do you mind following me on twitch? i'm just trying to gain followers desperately lol
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
No problem wait u have a link or sth like that? btw I will also revise now, but maths xD @cone
cone
coneOP•3w ago
oh sorry gimmi a sec
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
np
cone
coneOP•3w ago
Twitch
justconettv - Twitch
Everyone is welcome to the stream!
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
oh gta nice! I will have a look when u stream soon
cone
coneOP•3w ago
i like maths but A level maths is too hard man wish i took it now tho instead of psychology and sociology
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
okay xD u dont like them?
cone
coneOP•3w ago
im streaming at about 8pm
KingSchorschi.xyz
KingSchorschi.xyz•3w ago
okay, should be there

Did you find this page helpful?