Python Forum
Need help with code :(
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with code :(
#1
I'm new to Python and I have a presentation due in however all my members are not helping or responding the presentation requires us to make uml diagrams such as a use case diagram, activity and class. However the last bit is the python code.

The assignment brief is about sharedpower and how 2 users can register, login and search tool 1 user to hire tools and the other to book tools and collect them or arrange a dispatch driver to drop the tool or deliver it back.

My code is not the best hence why I'm seeking help.

I need help with the interface looping back to search tool and if possible some how make a code to tell python to only allow login if registered because at the minute you can login with anything.

Here are the instructions given to us:

Interface
You may use text based menus similar to the ones you used lab exercises e.g.
1) Login
2) Search for tools
3) Create new account
4) Exit
Enter your choice:
or you may design Graphical User Interface menus if you wish.
Functional logic
You should also write code to implement a version of the basic functions that the system provides, using the techniques you have learned including appropriate data structures and techniques (extending these if you wish)
You are not required to implement a client-server model with network connection.

Here is my code at the moment please don't judge as I'm still trying my best to learn.

#print ("1)Login, 2) search for tools, 3)create new account, 4)exit ")
#Your Choice")

print("_______________________________________________________________________________")

print ("                           Welcome To SharedPower!                            ")

print("_______________________________________________________________________________")

print()

print("                1.Login   2.Register   3.Search Tool   4.Exit                  ")

print("_______________________________________________________________________________")

print()  # for 1 blank line
print()  #for 2 blank line



#Using a while loop in order to get specific input (1,2,3 or 4)  if not then it will keeping looping     
inp = ""
while inp != "1" and inp != "2" and inp!="3" and inp!="4":

#inp will be used to store input from user
    inp = input("                            Select Option (1-4): ")
    print("________________________________________________________________________________")
    
#If input from user is "4" then it will exit
if inp =="4":
    exit()
    
#If input from user is "1" then begin Login
    if inp=="1":
        input1 = input("Enter Username: ")
    print("________________________________________________________________________________")
    input2 = input("Enter Password: ")
    print("________________________________________________________________________________")
    print ("You Are Now Logged In: ")
    print ("Hello,"),print(input1)
    

if inp == "2":

    print("________________________________________________________________________________")


    
    print("Register To SharedPower!")
    print("________________________________________________________________________________")

    
    user = input("Create A Username : ")
    print("________________________________________________________________________________")
    password = input("Create A Password: ")
    print("________________________________________________________________________________")
    
    date_of_birth = input("What Is Your Date Of Birth DD/MM/YY: ")
    print("________________________________________________________________________________")
    print()
    print ("Login:")
    print("________________________________________________________________________________")
    input1 = input("Enter Username: ")
    print("________________________________________________________________________________")
    input2 = input("Enter Password: ")
    print("________________________________________________________________________________")
    print ("You Are Now Logged In: ")
    print ("Hello,"),print(input1)
    
    print("Welcome To SharedPower!")
    print("________________________________________________________________________________")



inp = ""
if inp == "3":
    
    print("                                Search Tools ")

#Here we have created a function in order to tell python to check a users input with the list.

def linearSearch(item,my_list):
    found = False
    position = 0
    while position < len(my_list) and not found:
        if my_list[position] == item:
            found = True
        position = position + 1
    return found

    
#List of tools avalible
Tools = ['sledge hammer','screwdriver','ladder','sander','powerdrill','gluegun','torches','nail gun','planer','battery','power screwdriver']
item = input('Enter The Name Of The Tool:  ')

#If a tool is found within the list it will print tool avaliable
itemFound = linearSearch(item,Tools)
if itemFound:
    print("________________________________________________________________________________")
    print('Tool Is Avaliable For Booking! ')

#If tool not in list of tools it will print not available
else:
    print("________________________________________________________________________________")
    print ('Oops, The Tool Is Not Available Or Doesnt Exist!')
Will appreciate help so badly thanks guy any suggestions please let me know

Full brief

Project Brief
SharedPower is an information system to help tradesmen to share expensive and specialist tools rather than buying them themselves.

• Registered owners add details of the tools they have available including the per day and per half day rate for each unit.

• Other registered users can hire the tools.


• They can search and check the availability of a tool, up to 6 weeks in advance. If a tool is free it can booked for up to 3 days.

• Though tools are usually collected by the hiring user it is possible to arrange a dispatch rider to pick-up or drop off in urgent situations.


• Returning a tool late is fined at double the day rate for every day it is missing.

• Once per month of all users are calculated and accounts are settled.


• A flat charge of £5 is added to all bills for insurance.

• When tools are checked in or out, photos and notes on condition are uploaded to the system.


• If there is a serious issue of damage or cwear with a unit, then insurance company investigates, determines who is at fault and if necessary pays for the repair of the tool.
• When tools are being repaired they are unavailable.
e.g. What are the different roles for the users interacting with the system which functions of the system they use, or interact with, and what information needs to be recorded about each of them? What are the functions the system must provide? How will they be accessed and organised?




Your group must investigate the basic example provided and based on your assumptions outline a clear vision of what the system will do and for whom. Your report should clearly present your groups’ assumptions about the system and description of the services it will provide.
Reply


Messages In This Thread
Need help with code :( - by Daniel97 - Jan-13-2018, 03:05 AM
RE: Need help with code :( - by Larz60+ - Jan-13-2018, 10:48 AM
RE: Need help with code :( - by gruntfutuk - Jan-15-2018, 11:08 AM

Forum Jump:

User Panel Messages

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