Code documentation:
Put comments about what the code is for, not what it does. For example, I had some code that looked like this
While (true) { // Java loop
AddTotal();
PrintTotal();
}
Well, it is understood thatg while (true) is a Java loop. A better comment would be
while (true) { // loops getting input until the user quits
AddTotal();
PrintTotal();
} // end while
INDENT!!!!! You will lose some points if your code isn’t indented well. This is crucial in program Readability.
Q1) Some websites impose certain rules for passwords registration. Write a Java program that checks whether a string is a valid password. Suppose the password rules are as follows:
A password must have exactly eight characters. A password consists of only letters and digits. No punctuations or special symbol is allowed. A password must contain at least two digits. The first and last character must be a digit. No two digit or character can be the same. You are to write a Java application (no regular expression is allowed) to allow users to register their password. Loop must be used to validate each character (marks will be deducted if no loop is not used). (50 marks)
Examples of data entry are appended below: Please enter a new password: 7zan91 Error: Eight character is required, please reenter. 7anbvxmP. Error: Last character must be a digit, please reenter. 7anbvnn9. Error: You are not allowed to repeat any character, please reenter. 7*&bvyn9. Error: You are not allowed to enter special symbols. 7anbctq9.
Thank you for registering for us!
Q2) Luckluck is a legalized form of lottery sold in Singapore, known by different names elsewhere.
Method of Play:
A buyer picks at least six numbers, each on a basis of 1 to 49 (You must use Random class for this). No two same numbers are allowed. The winning numbers drawn include six numbers plus an additional number. Three or more winning numbers on a ticket matching the seven numbers drawn qualifies the buyer for a cash prize. The prize money escalates with the increase in numbers matched.
The maximum allowed matching numbers is six. Thus, if six numbers on the TOTO ticket matches the six numbers drawn, the jackpot (Group 1) prize is won.
Placing of bets:
There are 4 different ways to place bets:
QuickPick The computer randomly selects 6 numbers from 1 to 49 for the buyer. No bet slip is required for QuickPick bets.
Ordinary Bet The buyer selects 6 numbers from 1 to 49 by marking them on a bet slip.
System Bet The buyer selects 7 to 10 numbers from 1 to 49 by marking on a bet slip. For example, a System 9 bet is a selection of 9 numbers.
System Roll The buyer selects only 5 numbers from 1 to 49. The 6th number is a guaranteed winning number.
Bet Cost
Bet Type Cost
Ordinary S$1
System 7 S$7
System 8 S$28
System 9 S$84
System 10 S$210
System Roll S$44
Payout and odds: There is a prize pool assumed to be 1,000,000. The prize pool is divided between 6 prize groups.
Prize Group Winning numbers matched Prize amount (S$)
1 6 numbers 33% of prize pool
2 5 numbers plus the additional number 13% of prize pool
3 5 numbers 13% of the prize pool
4 4 numbers plus the additional number $30 per winning combination
5 4 numbers $30 per winning combination
6 3 numbers plus the additional number $20 per winning combination
7 3 numbers $10 per winning combination
Below is the sample game and payout: Total prize: $1,000,000 ways to bet:
How do you want to place your bet:
1 Ordinary
2 System 7
3 System 8
4 System 9
5 System 10
6 System Roll
Enter now: 1
Enter six numbers from 1 to 49 (No repeating of number):
3 19 10 21 33 41
Winning numbers: 3 19 21 25 31 44
You Won 3 numbers, total prize = $10.0
Last Completed Projects
| topic title | academic level | Writer | delivered |
|---|
Are you looking for a similar paper or any other quality academic essay? Then look no further. Our research paper writing service is what you require. Our team of experienced writers is on standby to deliver to you an original paper as per your specified instructions with zero plagiarism guaranteed. This is the perfect way you can prepare your own unique academic paper and score the grades you deserve.
Use the order calculator below and get started! Contact our live support team for any assistance or inquiry.
[order_calculator]