Python Forum
computer science coursework, read the text please and tell me if theres any specifics
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
computer science coursework, read the text please and tell me if theres any specifics
#1
I've been given this plan telling me that I need to design a computer program for counting coins, I am given a scenario which is telling me that there is a charity that is collecting money into bags, each coin type (example: £1 £2, etc) has a maximum amount for a bag which it must be equal to, so every bag should be a specific weight which matches to the specific bag value (for example the coin type £1 has a maximum of £20 for each bag, a bag with £20 weighs 8.75g) we have been given a large text file containing names of volunteers that are counting money(some accurate some not), the coin type that they are counting (£1, £2, 50p, etc) and it also says whether it is correct or not by a 'Y' or 'N' at the end of the text, this is a sample of what the data looks like (Abena,5p,325.00, Y)

also, I want the GUI to be in Tkinter just incase my school does not have 3rd party GUI interfaces

we need to make a program which
1.allows the user to input the volunteer's name
2. type of coin and weight of the bag,
3. validate coin type,
4.indicate the number of coins to be added or removed to correct an inaccurate bag weight,
5. maintain running totals of the number of bags checked and total value,
6.provide an option to display a list of volunteers sorted by accuracy showing the total number of bags counted and the number of bags they have counted correctly as a percentage of their total

I want to also make a GUI for it, but where do I start? I really want a grade 9 and by no means am I willing to cheat. what syntaxes will I need to research and for this computer program?

please if anybody can give me information on GUI it would be very helpful, one thing that I specifically am confused about is whether I can make this without a GUI and once I have done that can I then make it with a GUI or should I make a GUI first

also please before you call me trash I know this already, I have no knowledge of programming but I am doing this as coursework and need to learn python and make something that makes my teacher lose his brain. I am writing this from home although my work is coursework I am going to learn at home and implement at school so please any information would be beyond helpful whether its specifically GUI or just python syntax in general.
I understand things that I would need to do like I know I would need to make the program open this text file and sample the data but I have no idea how to actually do these things and I also would like to make a menu

I know this might sound far fetched as I am quite the amateur but I am watching lots of python courses and am spending lots of time on this so please any help will not just go to waste
buran write Nov-07-2020, 08:19 PM:
contact information on discord removed
Reply
#2
We are glad to help, but we are not going to do your work for you. It's my understanding that you also don't ask for it.

It looks like you need a tutorial. probably you have some study material - textbooks, lectures, course notes, etc.
I would suggest you find one and work trough it. It's not possible that we teach you everything/from basics. we can only help if you have specific questions.

(Nov-07-2020, 10:05 AM)sixcray Wrote: one thing that I specifically am confused about is whether I can make this without a GUI and once I have done that can I then make it with a GUI

Actually that's the right way to do it - separate logic from GUI. Note, it's very important that you have a well designed and well structured code in order this to work. Think of classes, functions, etc. i.e. split everything you want this program to do in small chunks, that you can write and test separately. If you go wrong with this (e.g. some hundred lines of code spaghetti code, no functions, classes) you will be in trouble. So think about the design in advance, before you start writing code. When you have it working without GUI it will be easy (assuming good design) to add GUI.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
I have done some research (and by some I mean I have spent the last week working through python making simple programs such as calculators, mad libs games, and just little projects containing loops and other things similar to this, I believe I am ready to begin the designing of this, you are correct in that I am not asking for you to do this for me as I hope to learn python and other languages to a very high level in the future. I will use this forum whenever I feel genuinely stuck, and by stuck, I do not mean there is a fault within my program which gives me a syntax or something like that, I mean if I do not know how to do a certain command in practice as I usually find it difficult finding this sort of help from google as it tends to be tricky,

it turns out I do not actually have to make a GUI as it is seen as "too complex for the year I am in" but i am most likely going to make one anyway after the standard code.

thank you for your help! I will let you know when I have any more queries
Reply
#4
i have an issue with my file,

pretty much, the data we are given is written on a txt file,at the moment i am trying to get this data and create an object with it, i have a folder with the txt file, a py file so that i can differentiate them into classes, and also the actual coincount python file
i am not asking for this to be changed although do as you like

this is my py.file at the moment that is named 'Volunteer _Class':
-------------------------------------------------------------------------------------------------------------------
class Volunteer:

    def __init__(self,name,coin_type,weight_of_bag,TrueCount):
        self.name = (name)
        self.coin_type = (coin_type)
        self.weight_of_bag = (weight_of_bag)
        self.TrueCount = (TrueCount)
------------------------------------------------------------------------------------------------------------------
at this point, I am just trying to make an object for the volunteer containing data of their name, coin type, the weight of the bag, and whether the bag they have is True or False (none of this has an issue as of now)

the problem occurs within my txt file and my coincount.py

this is my coin count file right now:
-------------------------------------------------------------------------------------------------------------------
import sys                 #so that later on I can exit easily

CoinCountData = open("CoinCountData.txt","r") #to open the actual text file

class Volunteer:

    def __init__(self,name,coin_type,weight_of_bag,TrueCount):
        self.name = (name)
        self.coin_type = (coin_type)                            #a function allowing me to class the data
        self.weight_of_bag = (weight_of_bag)
        self.TrueCount = (TrueCount)

Volunteer1 = Volunteer(CoinCountData.read())

print(Volunteer1.name)
-----------------------------------------------------------------------------------------------------------------
the code above displays a TypeError, this is what it says:
-----------------------------------------------------------------------------------------------------------------
Error:
Traceback (most recent call last): File "C:\Users\Owner\Desktop\CW\!Coincount\coincount.py", line 13, in <module> Volunteer1 = Volunteer(CoinCountData.read()) TypeError: __init__() missing 3 required positional arguments: 'coin_type', 'weight_of_bag', and 'TrueCount'
-----------------------------------------------------------------------------------------------------------------
I wanted to figure out why the error was being displayed so I changed my coincount.py code a little so that it would display me the lines of all of the coincountdata I had opened.

I will give you a sample of what the standard txt file says on notepad:

Output:
Abena,5p,325.00,Y Malcolm,1p,3356.00,Y Jane,£2,120.00,Y Andy,£1,166.25,N
it basically is showing the name, coin type, weight and Y or N (which i will code into a boolean later)

however, when I open this text file using the following code:
-------------------------------------------------------------------------------------------------------
CoinCountData = open("CoinCountData.txt","r") #to open the actual text file
print(CoinCountData.read())
-------------------------------------------------------------------------------------------------------
it prints out all the data in the list, however, they are printed with symbol.
this is the same sample I showed you previously, the difference is instead of opening it using my file explorer and licking the data, I opened and read it using python

Output:
Abena,5p,325.00,Y Malcolm,1p,3356.00,Y Jane,£2,120.00,Y Andy,£1,166.25,N
the test shows many foreign codes which are not visible in the actual file, I want to know how I can change this
so that when I open the file in python it shows me the values as they are instead of these weird symbols

I need to figure this out as otherwise, I will not be able to assign this code to an actual volunteer list

please help asapp!!!
buran write Nov-11-2020, 03:15 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#5
what python version do you use?

as to the TypeError - you read the whole file as one big string, you need to read and parse line by line and split the information on each line in chunks that you pass to create instance of Volunteer class. There are also other issue with your code, but not critical
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Having trouble with my Computer Science task Dunxx 1 1,784 Oct-07-2021, 12:32 PM
Last Post: DeaD_EyE
  Computer science can you help me with the last part of the code after mentionedWords. shirleylam852 9 4,077 Nov-28-2020, 01:29 AM
Last Post: shirleylam852
  Read text file, process data and print specific output Happythankyoumoreplease 3 2,921 Feb-20-2020, 12:19 PM
Last Post: jefsummers
  Read a data from text file (Notepad) Leonzxd 24 13,914 May-23-2018, 12:17 AM
Last Post: wavic
  Cannot read from text file aljonesy 5 3,612 Oct-05-2017, 05:56 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020