In: Computer Science
Having trouble getting started on this
Overview
As a programmer, you have be asked by a good friend to create a program that will allow them to keep track of their personal expenses. They want to be able to enter their expenses for the month, store them in a file, and then have the ability to retrieve them later. However, your friend only wants certain people to have the ability to view his or her expenses, so they are requesting that you include some sort of login functionality.
Instructions
For this challenge, you will start this application for your friend by concentrating on the login functionality. You will have a standard report in a text file where you will build login functionality to access. Below you will find the step by step instructions on how to develop this application.
what I have so far:
hasAt=False
while (not hasAt):
username= input("what is your username?")
if "@" not in username:
print ("wrong username")
print ("try again loser")
else:
password= input ("what is your password?")
hasAt=True
Hi,
I have worked on this application in my project , I can help you out for sure.
Some important point to keep in mind for this application :
1. Since this is related to money from person 1 to person 2.
2. Its kind of banking transaction when you will transfer money to another person from your account.
3. So here also you need to take care of debit and credit for both the person.
Note : for every transaction you need to maintain two rows, it will be like one for debit , another for credit.
ex : let say person 1 gave 500 to person 2, so you can maintain it like :
user 1 user 2 amount
person 1 person 2 500(positive means you will get back this much money)
person 2 person 1 -500(negative means you need to pay this amount)
4. If you want to decide which all user can see the application or not , you can take one variable as per user
like this :
user Name isValidAudience
abel true
john false
roy true
so based on this isValidAudience you see decide you you want to show application to that user or not.
This approach will make this application very easy .
let me just explain with one example, how it will work :
let say
1. Abel gave 500 to john
2. john gave 300 to sandy
3. sandy gave 600 to abel
so how you will store data is :
User 1 User 2 amount
abel john 500
john abel -500
john sandy 300
sandy john -300
sandy abel 600
abel sandy -600
So for above three transaction your file will have these 6 rows
Question 1) how much amount abel will give to other users in total ?
Ans : just sum the amount of all rows for which user 1 == abel.
like here 1st and 6th row : 500 + (-600) = -100
in total abel will pay 100 after balance amount.
this way you can find any data from this table, please try to understand this, I am sure you will be able to do it now easily.