Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MAKE PROGRAM FOR JAVA This program will have two parts: Part 1: Create a program that allows the user to create accounts. For each new

MAKE PROGRAM FOR JAVA

This program will have two parts:

Part 1:

Create a program that allows the user to create accounts. For each new account, ask the user to enter a username and password separately. Save the account information to a text file, called "accounts.txt". When adding to the text file, each account should be on a separate line with a space between username and password. After each account has been entered, the user should be asked whether or not they want to enter another one. If they choose to quit, display "Goodbye."

Part 2:

In the second part, read in the account information from "accounts.txt". Create two ArrayLists - one for the usernames and one for the passwords. For each line read in from the text file, add the username and password into their respective ArrayLists.

Notice that since each username and password is added at the same rate, the index value should always match. For example, the first account should have the username at index of 0 in one ArrayList, and the password at index of 0 in the second ArrayList. The second account should have username at index 1 and password at index 1. And so on...

Once all of the information from "accounts.txt" has been successfully added to the ArrayLists, don't forget to close the Scanner we used to read the text file!

Next, ask the user to login by entering a username. Check to see if that username is in the corresponding ArrayList. If so, ask them to enter a password and check to see if they entered the correct password. If not, display a message "That account does not exist."

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions