12. a. Create a TaxReturn class with fields that hold a taxpayer's Social Security number, last name, first name, street address, city, state, zip code, annual income, marital status, and tax liability. Include a constructor that requires arguments that provide values for all the fields other than the tax liability. The constructor calculates the tax liability based on annual income and marital status. The following table shows the percentage of income that is taxed. INCOME ($) 0-20,000 20,001-50,000 50,001 and over SINGLE STATUS 15% 22% 30% MARRIED STATUS 14% 20% 28% In the TaxReturn class, also include a display method that displays all the TaxReturn data. Save the file as Tax Return.java. b. Create an application that prompts a user for the data needed to create a TaxReturn. Continue to prompt the user for data as long as any of the following are true: > The Social Security number is not in the correct format, with digits and dashes in the appropriate positions-for example, 999-99-9999. > The zip code is not five digits. > The marital status does not begin with one of the following: S, s, M, or m. >The annual income is negative. After each item of the input data is correct, create a TaxReturn object and then display its values. Save the t as Prepare Tax.java.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Java Programming Question 12 I am having trouble figuring this out. Help if any input and output would be helpful.
**Educational Website Content:**

---

**Chapter 7: Characters, Strings, and the StringBuilder**

**Exercise 10: Phone Number Formatter**
- **Objective:** Write a program that processes a user's input, ensuring it is a 10-digit number, and formats it into a standard phone number format with parentheses, a space, and a dash.
- **Example:** Convert `5153458912` to `(515) 345-8912`. 
- **Error Handling:** If the user input is not exactly 10 digits, display an error message and prompt again until a valid number or the exit code `999` is entered.
- **File to Save:** `PhoneNumberFormat.java`

**Exercise 11: Palindrome Checker**
- **Objective:** Create an application that checks if a user's input is a palindrome. A palindrome reads the same backward as forward, ignoring capitalization and punctuation.
- **Examples:** "Dot saw I was Tod", "Was it a car or a cat I saw?", and "Madam, I’m Adam".
- **File to Save:** `Palindrome.java`

**Exercise 12: Tax Return Application**
- **Part A:** Design a `TaxReturn` class to manage taxpayer information, including fields for Social Security number, last name, first name, address, city, state, zip code, annual income, marital status, and tax liability.
  - **Calculation:** The constructor calculates tax liability based on specified income brackets and marital status.
  
  **Income ($) | Single Status (%) | Married Status (%)**  
  0–20,000 | 15 | 14  
  20,001–50,000 | 22 | 20  
  50,001 and over | 30 | 28

- **Part B:** Create an application to collect user data to instantiate a `TaxReturn` object. Continue prompting the user until:
  - Social Security number is correctly formatted (e.g., `999-99-9999`).
  - Zip code is exactly five digits.
  - Marital status starts with: `S, s, M,` or `m`.
  - Annual income is non-negative.

- **Data Validation:** After each valid input, instantiate a `TaxReturn` object and display its values.
- **Files to Save:** `TaxReturn.java`, `PrepareTax.java`

---

**Visual Explanation:**
A table is included in the tax section to illustrate the
Transcribed Image Text:**Educational Website Content:** --- **Chapter 7: Characters, Strings, and the StringBuilder** **Exercise 10: Phone Number Formatter** - **Objective:** Write a program that processes a user's input, ensuring it is a 10-digit number, and formats it into a standard phone number format with parentheses, a space, and a dash. - **Example:** Convert `5153458912` to `(515) 345-8912`. - **Error Handling:** If the user input is not exactly 10 digits, display an error message and prompt again until a valid number or the exit code `999` is entered. - **File to Save:** `PhoneNumberFormat.java` **Exercise 11: Palindrome Checker** - **Objective:** Create an application that checks if a user's input is a palindrome. A palindrome reads the same backward as forward, ignoring capitalization and punctuation. - **Examples:** "Dot saw I was Tod", "Was it a car or a cat I saw?", and "Madam, I’m Adam". - **File to Save:** `Palindrome.java` **Exercise 12: Tax Return Application** - **Part A:** Design a `TaxReturn` class to manage taxpayer information, including fields for Social Security number, last name, first name, address, city, state, zip code, annual income, marital status, and tax liability. - **Calculation:** The constructor calculates tax liability based on specified income brackets and marital status. **Income ($) | Single Status (%) | Married Status (%)** 0–20,000 | 15 | 14 20,001–50,000 | 22 | 20 50,001 and over | 30 | 28 - **Part B:** Create an application to collect user data to instantiate a `TaxReturn` object. Continue prompting the user until: - Social Security number is correctly formatted (e.g., `999-99-9999`). - Zip code is exactly five digits. - Marital status starts with: `S, s, M,` or `m`. - Annual income is non-negative. - **Data Validation:** After each valid input, instantiate a `TaxReturn` object and display its values. - **Files to Save:** `TaxReturn.java`, `PrepareTax.java` --- **Visual Explanation:** A table is included in the tax section to illustrate the
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY