Highlights
The subsidies for doctor visit for common illnesses applicable to only 3 categories of Singapore citizens with and without income are listed here:
1. Pioneer citizens (born on or before 31 December 1949 and who is a Singapore citizen before 1 Jan 1987) receives up to $28.50 per doctor visit.
2. For non-pioneer citizens with household income up to $1100 per person receives up to $18.50 per doctor visit,
3. For non-pioneer citizens without income and living in residence with annual value up to $13000 receives up to $18.50 per doctor visit.
Singapore citizens not under these categories do not qualify for any subsidy for doctor
visit for common illnesses. Outline the control structures of structured programming to write a program that
(i) prompts and reads
A. the bill amount,
B. the birth year of the citizen,
C. the year citizenship is obtained only if the user enters 1949 or earlier for the birth year,
D. whether the citizen has an income only if the citizen is not from the pioneer generation,
E. either the monthly income or the annual value of the residence only if the citizen is not from the pioneer generation.
(ii) uses table 1 to determine and display the amount subsidy. If no subsidy is applicable, it prints a message to state that the citizen does not qualify for subsidy.
(iii) computes the amount payable. The amount payable cannot be negative.
Without using arrays or regular expressions, write a Java program to implement the game MasterMindTM using only strings, characters and integers. Use the Scanner class to read user input and the Math class to generate random number. For the game, you must adhere to the following constraints:
1. Your program makes 4 random choices to pick 4 different colours from 6 colours (stored as a string "RGBYOP"). The letters represent the 6 distinct colours: Red, Green, Blue, Yellow, Orange and Purple. The random choices are stored as a single string e.g., "YBRP".
2. The player’s guess is read as a string and consists of 4 different letters for 4 different colours e.g., "BORY". Each correct colour guessed in the right position earns a black pin (B) and each correct colour guessed in a wrong position earns a white pin (W). In this example, the guess earns 2 white pins and 1 black pin, and the program displays
WWB.
2. The player wins if he is able to guess the 4 correct colours in the correct positions within 8 attempts.
A. The player is allowed to quit a game at any time by entering q when prompted for a guess.
B. At the end of a game, the program prompts the player whether he wants to play a new game. The user should enter q if he wishes to exit the program.
C. Outline the control structures of structured programming and use ALL three repetition structures: for, while and do-while..
Submit your program listing together with screenshot showing two runs of your program output.© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.