Perform error checking to ensure time was entered in proper

Assignment Help JAVA Programming
Reference no: EM131604425

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

Reference no: EM131604425

Questions Cloud

Cash flows-what happens in the cash account during the year : The statement of cash flows for Baldwin Company shows what happens in the Cash account during the year.
Identify specific conduct violations committed : Identify specific conduct violations committed by the organization and accounting firm in question. Examine the key inferences of corporate ethics related.
Calculations of merchandising accounts : Calculations of Merchandising Accounts. Based on the following, calculate net sales: 99 Sales Discount $15 Purchases $
Should the quantity produced be increased or decreased : When production is 2000, marginal revenue is $4 per unit and marginal cost is $3.25 per unit. Do you expect maximum profit to occur at a production level.
Perform error checking to ensure time was entered in proper : Write a program that validates a sale in dollars and cents - Perform error checking to ensure time was entered in proper format
What is an appropriate timeline for evaluation : How long would it take for the proposed change to become status quo, or refreeze, and what is an appropriate timeline for evaluation?
Does the concept of judicial interpretation of the law mean : Does the concept of judicial interpretation of the law mean that judges can make whatever law they wish?
Explain the effects of psychoactive drugs and hallucinogens : Can drugs be used for positive purposes. Think of the effects of psychoactive drugs/hallucinogens, stimulants, depressants, etc
How the marginal cost changes as quantity produced increases : Let C(q) be the total cost of producing a quantity q of a certain product. See Figure.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd