Keeping Track Of Inventory For A Company - How To Update Variables

Feb 11, 2015

My program is supposed to be used to keep track of inventory for a company. The user is prompted with a menu that asks them which item they want to update and then gives them another menu that allows them to buy, sell, or change the price of the items. For this, I need to have the variable values to change (based on the input of the user), because they are initially set to specific numbers. How would I do this?

Here's the part of my code that is relevant to this question:

balance = 4000.00;
lampQuantity = 400;
lampPrice = 10;
chairQuantity = 250;
chairPrice = 20.00;
deskQuantity = 300;
deskPrice = 100.00;
  
System.out.println("Current Balance: $" + balance);
System.out.print("1. Lamps " + lampQuantity);
System.out.println(" at $" + lampPrice);
System.out.print("2. Chairs " + chairQuantity);
System.out.println(" at $" + chairPrice);

[Code] .....

View Replies


ADVERTISEMENT

Keeping Track Of Team Standings In A League

Apr 18, 2014

Here are my conditions: You are developing a program to keep track of team standings in a league. When a game is played, the winning team (the team with the higher score) gets 2 points and the losing team gets no points. If there is a tie, both teams get 1 point. The order of the standings must be adjusted whenever the results of a game between two teams are reported. The following class records the results of one game.

public class GameResult
{
public String homeTeam() // name of home team
{ /* code not shown */ }

public String awayTeam() // name of away team

[Code] ....

The class TeamStandings stores information on the team standings. A partial declaration is shown below.

public class TeamStandings
{
TeamInfo[] standings; // maintained in decreasing order by points,
// teams with equal points can be in any order
public void recordGameResult(GameResult result)

[Code] ....

And here is the actual question:

Write the method adjust. The method adjust should increment the team points for the team found at the index position in standings by the amount given by the parameter points. In addition, the position of the team found at index in standings should be changed to maintain standings in decreasing order by points; teams for which points are equal can appear in any order.

And here is what I have so far:

private void adjust(int index, int points)
{
int Score[] = new int[standings.length]
for ( int i=0; i <= standings.length; i++)
{
Score[i] = index, points;
}
}

View Replies View Related

JavaFX 2.0 :: TableView - Keeping Track Of Topmost Visible Row

Apr 1, 2015

I have a TableView and it is scrolled to have some rows visible. Lets call the top visible row T, and the bottom one B.

I now replace the items in the TableView with a whole new list of items (so new data to view), but I want to scroll back to either T or B.

It seems to me that I have to somehow keep track of the topmost visible row, or the bottom-most visible row, but I can't figure out how to do that.

View Replies View Related

Swing/AWT/SWT :: Keeping Track Of Strings Drawn On JPanel Using Paint

Nov 1, 2014

So, I have this simple program that paints a string on JPanel using g2.drawString("Hello world", 40, 120). Basically, I want to be able to keep track of many strings on the JPanel at once. I'm not sure how to do this. For example, I would want to have an ArrayList of objects that keep track of these strings.

I want to be able to click-and-drag these strings so I will need to know there locations, etc.

Right now, using g2.drawString, it only draws the string. I want something like gw.draw(myStringObject).

import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JFrame;
import javax.swing.JPanel;

[Code] .....

View Replies View Related

Keeping Track Of Product With Highest Price - Loop Condition

Sep 22, 2014

The Program prompts the user to enter the number of products in the product catalog. The program should then prompt the user for the name and the price of each product in the product catalog. Once all of the products have been entered, the program should output the product information (name and price) of the most expensive product in the catalog. Your solution to keep track of the product with the highest price.

import java.util.Scanner;
public class ProductTester {
private static final String price = null;
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Enter the number of Products: ");
int count = console.nextInt();

[Code] ....

View Replies View Related

Keeping Track Of Player Position In Monopoly Board Game

Jun 28, 2014

I am trying to design a monopoly board game with a class and a main program. I can not make the method to keep track of the player's position after every roll. After every roll it prints "Previous position: 0".The player should also not go over 14th spot because the board is just 15 including 0. That is what I have (just the particular method and the part from the main program which call it).

public int getpospl1()
{
System.out.println( getplayer1name() + " Rolls "
+ "Dice 1: " + getrolld1() + "" + "Dice 2: " + getrolld2() + "" );
int spot1 = 14; //The end spot
int start = 0;
int previousPosition = start;

[Code] .....

View Replies View Related

Inventory Form Program - User Update Data In The Table

Apr 30, 2015

I'm getting ready to code a program that takes record of items loaned and return in a table. I want more than one user to access the program to be able to update the data in the table. For instance, if one user added 5 new items to the table, all other users would be able open the program to see a modified table with 5 new items. Was looking for some advice and was wondering if implementing a database would work best.

View Replies View Related

Adding Sort And Total Inventory Methods In Inventory Class

Apr 30, 2014

for my assignment I am to only add the sort and total inventory methods in the inventory class. And not create an array in the inventory class at all. My inventory class should contain all the variables needed to use with the two new methods: sort and calculate total inventory.By not creating any array in the inventory class and not touching the variables at all.

What I have came up with is:

public class inventory
{
private int prodNumber; // product number
private String prodName; // product name
private int unitsTotal; // total units in stock
private double unitPrice; // price per unit
private double totalInventory; // amount of total inventory
// initialize four-argument constructor

[Code] ....

The error message I get is:

F:Java Programminginventory.java:62: error: cannot find symbol
return prodName.compareTo ( s. getprodName() );
^
symbol: method getprodName()
location: variable s of type inventory
1 error

View Replies View Related

Map That Shows The Stock Of Some Company

Dec 16, 2014

Is there anyway i could clean this up. ??

package map;
import java.io.*;
import java.util.*;
public class Map {
public static void main(String[]args)throws Exception{

[Code] .....

View Replies View Related

Java Array Update Without Using ArrayList - Add Values And Update Size?

Feb 9, 2015

I am trying to create an array list without using the built in arrayList class that java has. I need to start the array being empty with a length of 5. I then add objects to the array. I want to check if the array is full and if not add a value to the next empty space. Once the array is full I then need to create a second array that starts empty and with the length of the first array + 1.

The contents of the first array are then copied into the new array without using the built in copy classes java has and then the new array ends up containing 5 elements and one null space the first time round. The first array is then overwritten with the new array containing the 5 elements and the null space. The process then starts again adding values until the array is full which will be 1 more value then recreating the second array empty and the length of the first array + 1. This is my attempt at creating this but I have run into multiple problems where I get only the last value I added and the rest of the values are null:

public class MyArrayList {
public Object arrayList[];
public MyArrayList(Object[] arrayList) {
this.arrayList = arrayList;

[code]...

View Replies View Related

Get SQL Exception That Column Company Not Found

Jul 15, 2014

I try to run this query select distinct TRIM(company) from catalog where company != '' order by company asc; and i get an SQL exception that Column company not found.. When i run this query in MySql workbench it works fine?

View Replies View Related

JSF :: Update Action Does Not Update Bean Attribute

May 14, 2014

I have a strange behaviour when trying to update a bean. Here is the edit page:

<h3>Edit Post</h3>
<div class="row">
<h:form>
<div class="small-3 columns">
<label for="right-label" class="right inline">Title</label>

[Code] ....

Here is the bean class:

package com.airial.controllers;
import com.airial.domain.Post;
import com.airial.service.PostService;
import com.ocpsoft.pretty.faces.annotation.URLMapping;
import com.ocpsoft.pretty.faces.annotation.URLMappings;
import org.springframework.beans.factory.annotation.Autowired;

[code]...

postToUpdatet is always NULL. Why the title property is not binded ? What is wrong here ?

View Replies View Related

Java Program That Calculate And Print Bill For Cellular Telephone Company

Nov 6, 2014

package p6;

import java.util.Scanner;
public class Bill {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
//final variables Premium Service
final double monthlyChargeP = 25.00;
final double FordayminutesP = 0.10;

[Code] ....

I can't find the syntax on {} my block is highlighted red in my application

View Replies View Related

Payroll System For Hourly / Fixed Monthly And Commission Paid Workers Of Company

Dec 21, 2014

I am doing a program where i have to implement a payroll system into a company for hourly, fixed monthly and commission paid workers. I also have to put the method which i did. the problem is I cant tell if my calculation is wrong or if i am missing a codes some where. The output is not giving me the answer that I was at least expected,

Here is my method:

{
< double total_deduction;>
< total_deduction = gross_pay - deduction;>
< return total_deduction;>
}
< public static double calGrossH(double hours_worked, double pay_rate)>

[Code] .....

I have done a lot researching and have come up with some search with almost the same calculation and I have also asked employees of a company on how they calculated hourly rate, commissions rate and fixed rate for all workers and gotten the same response but for some reason the output is not what it is supposed to output. here is my output.

<
un:>
<please enter the number of employees to be processed 31>
<please enter employee id number 3669>
<please enter employee first name>

[Code] ....

I dont know if I am missing some calculation somewhere or codes been researching and bussing my brains to figure out where is the missing codes or calculation.

View Replies View Related

How To Resize Array With Keeping Previous Value

Jan 29, 2014

Suppose i have a book class and bookArray class.in book class contains four fields name,id ,publisher and author. in bookArray class: book bookArray=new book[20]; i have to save those four fields in the array but after completed the array i should have re-size the array with contains the previous data. How?? I have pass those values from the main class..

View Replies View Related

Splitting A String While Keeping Some Spaces

Jan 21, 2014

I am trying to split a string into a String[] tokens array to declare variables for an object; however, I'm having an issue getting the string to tokenize correctly. Here's an example of the input:

a : 100 : John Smith : 20 Main St.
a : 101 : Mary Jones : 32 Brook Rd.

Here is the basic code I have now, to properly sort each line of text, etc. (without the split() method):

Java Code:

while (scanner.hasNextLine()) {
currentLine = scanner.nextLine();
lineScan = new Scanner(currentLine);
if (currentLine.startsWith("/") || currentLine.trim().isEmpty())
continue;

[Code] ....

I was able to eliminate the comments and identifiers from the text by trimming the first two characters of the string. For the split, I tried String[] tempArray = currentLine.split("s+"); however, that also took the spaces out of the addresses and names...so the results looked like this:

100
John
Smith
20
Main
St.

As you can see, it splits via space regardless, including where I replaced all the :'s with spaces. Is there any way to do this?

View Replies View Related

Making Home Inventory

Jan 22, 2014

I'm going to make Dekstop Based Home Inventory, do you have a tutorial for it ?

View Replies View Related

Calculate And Store Value Into String The User Selected And Keeping It Going

Oct 28, 2014

This is the first time we are using 2 different classes. This is the code I have so far. What I am having trouble is doing the calculations and storing the value into the planet the user selected and keeping it going. I will attach the instructions ....

public class FakeGravity{
// Instance variables
private String planet;
private int VelocityDecay;
private double BouncinessFactor;
// default constructor
public FakeGravity(){

[Code] ....

View Replies View Related

Iterating Through Months While Keeping In Mind Different Length Of Month

May 20, 2015

I have to create a method to find the current month with the input being a number of milliseconds using System.currentTimeMillis(). Now I was able to solve the problem with the following extremely cumbersome method:

public static int monthLeap(long ms) {
int result = 0;
int jan = 31, mar = 31, may = 31, jul = 31, aug = 31, oct = 31, dec = 31;
int apr = 30, jun = 30, sep = 30, nov = 30;
int feb = 28;
int febLeap = 29;

[Code] ....

I first go through a loop that goes through all the years and subtracting the number of days of a normal year or a leap year in milliseconds from the total milliseconds. At the end I should have a rest value of milliseconds that represents the amount of milliseconds that have passed already this year. Out of this number I then find the month we are currently in.

My problem is that the above method is way to large and I get a checkstyle warning: "NPath Complexity is 12,288 (max allowed is 80)".

I know that this can somehow be solved with a for loop iterating through the time and counting up months until there is no more month left. My problem though is the different lengths of the months. If each month was the same I could just subtract the amount of days in each month from the rest value.

(Since I already got it down to <= 12 months, I shouldnt bother with the extra days to find the month. Yet if I want to find the month when the date is the first or last day of the month it is important to be very precise) ....

View Replies View Related

JDBC :: Connection Pool Keeping More Than Necessary Inactive Connections

Jun 19, 2015

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production0PL/SQL Release 12.1.0.2.0 - Production0CORE12.1.0.2.0Production0TNS for Linux: Version 12.1.0.2.0 - Production0NLSRTL Version 12.1.0.2.0 - Production0 

Using JavaSE-1.7
Using ucp.jar,ons.jar and OJDBC7.jar

I set up the datasource as follows :
 
pds = PoolDataSourceFactory.getPoolDataSource();
  pds.setConnectionFactoryClassName(factoryClassName);
  pds.setMaxPoolSize(maxPoolSize);                                                       maxPoolSize  10
  pds.setMinPoolSize(minPoolLimit);                                                        minPoolLimit 1

[Code] ....
 
In the class that actually uses it I create a method variable for the connection object.

Closing the connection as well as pds.getConnection().close();e

I am thinking that at the most I should have only one inactive connection showing up when I monitor the session. How do I configure the pool as to only show on inactive connection? I am running the test queries once every five minutes. But I am opening three connections each time.

View Replies View Related

Inventory Program - CompareTo Not Working

Jul 16, 2014

My instructor gave me this code to use as my Array sort. I can not get this to work. I do not get any compile errors, the code just does not do anything.

Java Code:

package inventoryprogram4;
import java.util.Scanner;
public class Inventoryprogram4
{
static GUI mainGUI = new GUI();
static String outText = "";

[Code] .....

View Replies View Related

Inventory Part 2 Portion And Getting Errors

Apr 30, 2014

for my assignment I am to only add the sort and total inventory methods in the inventory class. And not create an array in the inventory class at all. My inventory class should contain all the variables needed to use with the two new methods: sort and calculate total inventory.By not creating any array in the inventory class and not touching the variables at all.For the inventoryTest class, I only need to declare an array of the inventory class by making an instance of the inventory.

public class inventory
{

private int prodNumber; // product number
private String prodName; // product name
private int unitsTotal; // total units in stock
private double unitPrice; // price per unit
private double totalInventory; // amount of total inventory

[code]...

View Replies View Related

Inventory Program - Display Information To GUI

Feb 28, 2015

I am trying to create a GUI with already existing code. My assignment is: Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that product. In addition, the GUI should display the value of the entire inventory, the additional attribute, and the restocking fee.

Where to start. The text book does not cover a GUI that displays this type of information rather it just displays graphics. I would like to create a separate class that holds the GUI information just to make everything flow better. I have provided my current code below:

Java Code:

// ProductTest.java
// by JakeB
public class ProductTest {
// main method begins
public static void main(String[] args) // begin main {
myGUI display = new myGUI();
display.setVisible(true);

[Code] .....

This is all I have for the GUI. I am at a total loss and I am behind 2 weeks now. I cannot move forward until I am able to get this done and the class ends next week.

View Replies View Related

Inventory Program - Taking Input For ArrayList

Feb 3, 2014

I am stumped on a coding project I am working on. I am making an inventory program with predefined values for the items. I am not sure how to iterate through my arrayList, and allow the user to input the "number sold."

I have made an arrayList and populated it using the add(), but I am not sure if it is working correctly. This is my inventoryItem class :

package inventory;
import java.text.DecimalFormat;
public class inventoryItm {
String itemName;
double unitPrice;
int numberSold;

[Code] .....

View Replies View Related

Inventory And InventoryItem Class - Cannot Find Symbol

Oct 13, 2014

I created a Test main method to test my Inventory and InventoryItem class to see if they are functioning properly. I am currently trying to read a text .dat file, but I keep getting "...cannot find symbol" for descripIn when I try to compile it.

import java.util.Scanner;
import java.util.ArrayList;
import java.io.IOException;
import java.io.File;

[Code].....

View Replies View Related

Display Inventory In Console - Retail Items

Apr 7, 2014

Why does it keep giving me the error saying that RetailItem[] inventory not found(from the parameter) if its stated above?

RetailItem[] inventory = {jacket, jeans, shirt};
//Display the inventory in the console
display(inventory)
//Process a series of RetailItem sales
processSales(inventory);

//Display the updated inventory of Retailitems
display(inventory);

[Code] .....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved