Create a class to encapsulate the data and behavior

Assignment Help JAVA Programming
Reference no: EM13782793

Reading

Moodle: Class Coding Style

Java Classes

Java Application - Product and Inventory

Product.java

Create a class to encapsulate the data and behavior of a product in a store's inventory. The class should have the following data for an inventory item:

Product Number - String

Description - String

Quantity on hand - int

Product Price - double

Use appropriate access modifiers when defining the data

Code accessor and mutator (get and set) methods for all class instance variables. Be sure to follow the class style and use _ as the name for the parameter corresponding to the class instance variable. (Note the "_" starting the parameter name.)

If the product number or description is blank, or the values passed for the quantity or price are not valid, leave the associated instance variable unchanged.

Create a class method to calculate and return the total amount for the product based on the quantity on hand and the product price.

Use appropriate modifiers when creating the methods

Inventory.java

The main method in this class should create an instance of Product. It should then read inventory information from a text file named Inventory.txt and use the class mutators to put the information into the Product object. The Product object should then be passed to a method to display product information using the class accessors and member method.

The Inventory.txt file contains colon delimited fields for the product number, description, quantity on hand, and the product price for each inventory item. Upload this file from Moodle and use it in your application.

Reference no: EM13782793

Questions Cloud

Major responsibilities and functions of the controllers offi : • Major responsibilities and functions of the controller's office. • Major types of financial statements and their purposes. • Roles of internal and external audits. • Importance of accurate forecasting. • Purpose of yield management strategies.
Establishing correlation between variables : Describe different methods of establishing correlation between variables and provide an example of each (pearson's r & spearman rho).
Evaluate the effectiveness of those fiscal policy : Identify fiscal policies that are currently being recommended by government leadership - Evaluate the effectiveness of those fiscal policy recommendations from the Keynesian and Classical model perspectives.
Staffing and administrative issues in behavioral health : Staffing and Administrative Issues in Behavioral Health.
Create a class to encapsulate the data and behavior : Create a class to encapsulate the data and behavior of a product in a store's inventory. The class should have the following data for an inventory item
Limit overaggressive law enforcement : The Fourth Amendment is supposed to limit overaggressive law enforcement and government practices and make sure there are no unreasonable searches and seizures conducted on citizens.
What is an example of a global policing system : What is an example of a global policing system? How do global policing systems impact criminal activity on a global level? How can we better improve the approach in which global policing agencies combat crime on a global scale
Basic assumptions associated with chryslers culture : What are the observable artifacts, espoused values, and basic assumptions associated with Chrysler's culture? Explain.
Case study on management and org theory : Tom had always wanted to start his own business. He was talented in many areas and had great people skills.

Reviews

Write a Review

JAVA Programming Questions & Answers

  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.

  Consider the problem of finding the position

Consider the problem of finding the position, p, of the last occurrence of a given number, x, in an array, A. We thus want a function FindLast(A,n,x) with precondition

  Design a java program that has two parallel arrays

Design a java program that has two parallel arrays: a string array named people that is initialized with the names of seven of your friends, and a string array named phoneNumbers that is initialized with your friends phone numbers.

  Create class named horse

in Java Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these field. Next, create a subclass named RaceHorse, which contains and addtional field that holds the number of rea..

  Implement a fishlake simulation similar to the previous

implement a fishlake simulation similar to the previous assignment. you will then make adjustments to accommodate class

  Write a program arrayprocessing.java

Write a program ArrayProcessing.java that reads a file name from the keyboard. The file contains integers, each on a separate line. You then create a corresponding array with integers from the lines.

  Create an application for disney''s cottages

Create an application for Disney's Cottages, a weekend getaway resort that rents cottages and boats to use on the local lake

  Delete a random element from an arraylist

Elements in an ArrayList and picking one at random to remove. Unfortunately, this slow, since deleting a random element from an ArrayList is slow because of all the shifting. For this question, you should modify the poll()method so that it runs in..

  Create a histogram bar

Demonstrates an example of the user interface during your program's execution

  Determine the average amount of time people spend waiting

Determine the average amount of time people spend waiting for tables -  The fancy new French restaurant La Food is very popular for its authentic cuisine

  Complete and fully test the class characteristic

Complete and fully test the class Characteristic that Exercise explains. Suppose a class Characteristic that will be used in an online dating service to assess how compatible two people are.

  Create bean jsp program which will compute simple interest

Create the bean which will compute Simple Interest. Use bean in JSP program. Accept details of saving like principal amount, rate of interest, period-in years from user and show amount

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