Question
creat e a program to demonstrate the use of the class. The program should begin with a passcode validation that will only allow the user
creat e a program to demonstrate the use of the class. The program should begin with a passcode validation that will only allow the user to access the program if a passcode with at least 2 uppercase letters and at least 2 lowercase letters is entered. If an inaccurate passcode is entered, the program should loop and prompt the user again until a proper code is entered. (25 Points)
the class file ---
public class SalesData { private double[] sales; public SalesData(double[] s) { sales = new double[s.length]; for (int index = 0; index < s.length; index++) sales[index] = s[index]; } public double getTotal() { double total = 0.0; for (int index = 0; index < sales.length; index++) total += sales[index]; return total; } public double getAverage() { return getTotal() / sales.length; } public double getHighest() { double highest = sales[0]; for (int index = 1; index < sales.length; index++) { if (sales[index] > highest) highest = sales[index]; } return highest; } public double getLowest() { double lowest = sales[0]; for (int index = 1; index < sales.length; index++) { if (sales[index] < lowest) lowest = sales[index]; } return lowest; } }
5. Given the SalesData class file, complete the demo program for weekly sales that accepts sales figures for 5 days from the user into an array. Then, creat e an instance of the class and pass the array. Finally, return figures for output that should create an output similar to this: (75 Points)
using this class file, output should be like
Enter a Password:
mei,ej
The password did not meet the requirements
of at least 2 uppercase letters and
at least 3 lowercase letters
Please reenter the password:
Enter a Password:
uhduIWEII
Enter the sales for day 1
100
Enter the sales for day 2
200
Enter the sales for day 3
300
Enter the sales for day 4
400
Enter the sales for day 5
500
The total sales were $1,500.00
The average sales were $300.00
The highest sales were $500.00
The lowest sales were $100.00
Step by Step Solution
3.51 Rating (151 Votes )
There are 3 Steps involved in it
Step: 1
Heres the Java program that demonstrates the use of the SalesData class and implements passcode vali...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started