Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Basic Requirements

Write a program that validates a sale in dollars and cents with a $ and a .(period). See sample output below.
LiFiUnit6Ch15.java

- Driver class should loop until "q" is entered to quit
- If enter is not "q", then create an instance of the LiFiSaleCheck object passing the entry as an argument
- If no error
o Print amount by calling:
 print numeric from LiFiSaleCheck class
 print alphabetic from LiFiSaleCheck class
- If error
o Print error message (see sample)
LiFiSaleCheck.java class

Sales object should store the sale in 2 integer instance variables, dollars and cents, and include a string variable to hold the error. This should be initialized with null.

LiFiSaleCheck Constructor:
- Receive sale as a string
- Perform error checking to ensure time was entered in proper format to include a color (.) between the dollars and cents and a $ at the start of the string.
- Use indexOf and substring to separate the sale string into the appropriate instance variables
- Use try/catch to catch format errors of dollars and cents as shown in example
- If an error occurs, change the error instance variable to reflect the error (see sample)
- If more than one error occurs in the format of the dollars and cents, show both.

print numeric method:
- Print in the format $123.45 using both dollars and cents instance variables
- Print in the format 123 dollars and 45 cents using both dollars and cents instance variables

print alphabetic method:

- Print in the format 123 dollars and 45 cents using both dollars and cents instance variables getError method:
- Include a getError method that returns the error instance variable to the print method

Java, Programming

  • Category:- Java
  • Reference No.:- M92413138
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As