Question

In: Computer Science

Having trouble getting started on this Overview As a programmer, you have be asked by a...

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.

  1. Declaring Variables - You will start the application by declaring the following variables:
    1. username - initialized with an empty string to store the username entered by the user
    2. password - initialized with an empty string to store the password entered by the user
    3. repeat - initialized with the letter 'y' to control the looping of the program
    4. passwordLength - intialized with the number 8 to validate password length
    5. Four flags set to false named hasAmpersand, hasValidLength, isValidUsername, and isValidPassword
  2. Display the program header as shown in the images below
  3. Your program must allow the program to repeat without re-displaying the program header.
  4. You must obtain the username from the user then check to see if the username contains the @ symbol. If does, set the hasAmpersand flag to true and allow the program to continue. If it doesn't, alert the user that it is an invalid email and use the continue command to skip the rest of the code and repeat the program.
  5. Obtain the user password and use a while loop to make sure that the user has entered a password greater than the number stored in the passwordLength variable. After the password has been validated to be greater than the stated password length, change the hasValidLength flag to true.
  6. You will then use the hasAmpersand and hasValidLength flags to confirm whether or not to open the logins.txt file to confirm that this login information is present in the file. This is when you would change the appropriate isValid flags to state that they are in the file. (HINT: You can check first that the username is in the file, if not, then there is no need to check for the password.) If the username is not in the file, use the break statement to end the program as shown below.
  7. The report stored in the PersonalExpense.txt file should only be display if both the username and password is correct.
  8. The text files for this application are attached to the Dropbox. You may download and add them to your solution. Or feel free to create your own login and report pages

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

Solutions

Expert Solution

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.


Related Solutions

Hello, I am having trouble getting started on my project and building these functions. How do...
Hello, I am having trouble getting started on my project and building these functions. How do I build a function that continuously adds new "slices" to the list if they are below/above the size limit? I didn't copy the entire problem, but just for reference, when the code is run it will take user input for size limit (L), time cost for a random slice(R), and time cost for an accurate slice(A). Question: In real life, a steak is a...
I am having trouble with my assignment and getting compile errors on the following code. The...
I am having trouble with my assignment and getting compile errors on the following code. The instructions are in the initial comments. /* Chapter 5, Exercise 2 -Write a class "Plumbers" that handles emergency plumbing calls. -The company handles natural floods and burst pipes. -If the customer selects a flood, the program must prompt the user to determine the amount of damage for pricing. -Flood charging is based on the numbers of damaged rooms. 1 room costs $300.00, 2 rooms...
As a programmer in a java project, you have been asked by your project manager to...
As a programmer in a java project, you have been asked by your project manager to describe the most efficient way to store the following assigned numbers 10,20,30,1000,200,350 for an operation which involves on calculation such as sum and average.
I am taking a Data Structures and Program Design class. BUT, I am having trouble getting...
I am taking a Data Structures and Program Design class. BUT, I am having trouble getting access to the vectors so that I can compare the guesses with the random numbers. I’ve been working on this for several days and don't feel any closer to a solution and could really use some help as I really don't know how to get this to work. Thank you! The assignment is: Design an ADT for a one-person guessing game that chooses 4...
The Delta Insurance Company is having a policyholder subsystem which has started giving trouble. Over the...
The Delta Insurance Company is having a policyholder subsystem which has started giving trouble. Over the years, the application evolved from using fixed length, multi-record type files to using a hierarchic database to using a relational database. The programs did not change much, but the data structures changed radically. Program code was patched to provide for the new data structure. The amount of people-time allocated to policyholder maintenance grew 15% per year over the last five years and is now...
Please show your work. Having trouble getting to the answer. Anthony Chon, 65, has recently retired....
Please show your work. Having trouble getting to the answer. Anthony Chon, 65, has recently retired. He estimates that he will require $30,000 in after-tax real dollars per year. He does not expect to live beyond 90 years old. All his investments are in government bonds, expecting to yield a nominal rate of 6% per year. His tax rate is 30%, and the rate of inflation is expected to be 3%. How much money does he need today to support...
I'm having trouble getting a certain output with this code #include <stdio.h> //function prototypes void initializeArray(int...
I'm having trouble getting a certain output with this code #include <stdio.h> //function prototypes void initializeArray(int size, int ids[]); void printArray(int size, int * idPointer); int main(void) { // 1. declare an array of 5 integers called ids int ids[5]; // 2. declare an integer pointer called arrayPointer and // initialize it to point to the array called ids int *arrayPointer = ids; // 3. call initializeArray() function sending to it // 5 for the size and the array called...
You recently started working in at a University in the Math department as a software programmer....
You recently started working in at a University in the Math department as a software programmer. You need to build an app that can calculate the mod of two numbers. Users need to enter num1 and num2. The app should perform the calculation and display the output as num1 mod nub2 operation. For example, 25 mod 5=0 24 mod 5 = 4 Once you implement the mod operations, then you need to add following buttons. Addition Subtraction Division Power Follow...
I am having a hard time getting started on how to do this assignment. I would...
I am having a hard time getting started on how to do this assignment. I would like some ideas on how to start the MEMO. and maybe some ideas on what you would include. But I don't necessarily need the assignment completed for me. just need ideas!!! One routine negative message in the form of an internal memo. 400-500 word message. Single-spaced, with 1-inch margins on all sides. Objective: To announce organizational restructuring, one routine negative message addressed to employees....
You are using a microtome but are having trouble cutting the tissue into sections. Which troubleshooting...
You are using a microtome but are having trouble cutting the tissue into sections. Which troubleshooting strategy/strategies would you choose?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT