Customer Name Cannot Be Resolved To A Variable?

Jan 18, 2015

Here is my current code. The CustomerName in the System.out.print statement doesn't compile - it says that CustomerName can not be resolved to a variable. But why is that true? it is declared and assigned a value in the for loop.

Query query = em.createQuery("select CustomerName from web_cost_file,customer " +
"where web_cost_file.customer=customer.id and web_cost_file.customer=" +
costsFileList[0]);
List<Object[]> listCustomerName = query.getResultList();
 
for (Object[] result : listCustomerName) {
String CustomerName = result[0].toString();
}
System.out.print(CustomerName);

View Replies


ADVERTISEMENT

Word Cannot Be Resolved To A Variable Error

Jun 27, 2014

I am getting an error stating that 'word cannot be resolved to a variable' pointing to my return value. Why? Should I make a default String value for word before my while loop or something, like

String word = " ";
?

String getItRight(){//make sure the user enters the password correctly
Scanner input = new Scanner(System.in);
boolean repeating = true;
while(repeating){

[Code] ....

View Replies View Related

Eclipse Error - Cannot Be Resolved To A Variable

Jun 18, 2014

The error "cannot resolve to a variable". I get the error I just can't seem to fix the error.Presently I am working my way through the Oracle docs and that seems ok. Java for Dummies, Sams teach Yourself Java in 21 Days, plus my favorite Head First Java.

package tutorial;
import java.util.*;
public class HolidaySked {
BitSet sked;
public HolidaySked(){
sked = new BitSet (365);
int [] holiday = {1,15,50,148,185,246,281,
316,326,359};
for (int i = 0; i<holiday.length; i++){
addHoliday(holiday[i]);

[code]....

View Replies View Related

Methods Cannot Be Resolved To A Variable Or Is Not A Field

Feb 7, 2015

I've been using Eclipse and I realized that it compiles stuff into class files for you. So, I created a new project and each class is a separate .java file, with the .class files already there, but I cannot get rid of these errors. Or, say if I wrote them all into one file and then realized it needs to be 3 separate, or that all need to be in the same src file (oops)? Here are the errors:

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
random cannot be resolved or is not a field
guessp1 cannot be resolved to a variable
guessp1 cannot be resolved to a variable
guessp2 cannot be resolved to a variable
guessp2 cannot be resolved to a variable
guessp3 cannot be resolved to a variable
guessp3 cannot be resolved to a variable
guessp1 cannot be resolved to a variable
guessp2 cannot be resolved to a variable
guessp3 cannot be resolved to a variable

[code]....

View Replies View Related

Count Vowels In ArrayList Of Strings - N Cannot Be Resolved To A Variable

Sep 11, 2014

What I'm trying to do here is to count the vowels in an arraylist of strings. What I did may not be right, but that's not my problem for now. My problem is that i cannot return the value (n) I want to return. I don't know why.

import java.util.*;
import java.util.Arrays;
public class One {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<String>();
list.add("aaa");
list.add("brr");
list.add("unn");
System.out.println(vowels(list));

[URL] ....

View Replies View Related

How To Add Customer Class

Jun 24, 2014

-A customer has a name, an email address and a list of supplements which they are interested in.
-A paying customer has a payment method and a list of associate customers whom they also pay for.
-An associate customer is a customer whose subscription is paid for by a specified paying customer.
-A payment method could be by a specified credit card or direct debit from a specified bank account.
-A supplement has a name and a weekly cost.

The magazine also has a weekly cost for the main part.Each week, each customer gets an email telling them their magazine is ready to look at and listing the supplements that they currently subscribe to.Each month, each paying customer gets an email telling them how much is being charged to their card or account for the month and itemizing the cost by supplements for them and any of their associate customers.Design and implement enough functionality in the classes to allow the operation of the following test program (which you also design, implement, test, and document):The client program should do the following:

a) construct a magazine with an array of 3-4 supplements with made-up details built in to the program (Alternatively, get input from the user using the Java Scanner class),
b) construct an array of 5-6 different customers of various types with made-up details built in to the program (Alternatively, get input from the user using the Java Scanner class),
c) view details of all customers stored in the array,
d) print out the text of all the emails for all customers for one week of magazines,
e) print out the text for the end of month emails for the paying customers,
f) add a new customer to the magazine service,
g) remove an existing customer from the magazine service.
Display enough information during the running of the program to allow checking of its operation.

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignmentmag;
import java.util.*;
/**

[code]....

View Replies View Related

How To Do Selection Sort Of ArrayList By Customer Last Name

Nov 8, 2014

I have an arrayList with these values:

Mike Smith with a customer id of 100 has an account number of 1000 and a balance of $5,000.00
Hank Jones with a customer id of 101 has an account number of 1001 and a balance of $45,000.00
Sam Overstreet with a customer id of 102 has an account number of 1002 and a balance of $45,000.00
Hank Jones with a customer id of 101 has an account number of 1003 and a balance of $48,000.00
and so on .....

I am trying to do a selection sort by the account holders last name. I understand how to do if the Arraylist holds integers, but my arraylist holds multiple fields. I am not allowed to use collections as this is a homework assignment.

here is the Account Class

public class Account implements Comparable<Account> {
private int acctNum;
private double balance;
private Customer cust; // note we are putting a Customer object in the Account clas
private static int nextAcct = 1000;// used to keep track of the next available account number

[Code] ....

View Replies View Related

Program That Calculate Change Due To Customer By Denomination

Sep 20, 2014

write a program that calculates the change due to a customer by denomination; that is, how many pennies, nickels, dimes, etc. are needed in change. The input is to be purchase price and the size of the bill tendered by the customer($100, $50, $20, $10, $5, $1).

View Replies View Related

Enter Customer Information And Calculate Total Bill

Feb 28, 2014

You have a store that sells the following items:

Shoes $50.00
T-shirts $30.00
Shorts $75.00
Caps $15.00
Jackets $100.00

Your sales associates need a program where they can enter customer information and calculate the customer's total bill. When the sales associate enters the program they should be presented with this main menu.

Enter customer information
Display Total Bill
Quit

If the sales associate selects option 1, the program should allow the sales associate to input their name, address, and e-mail address. Your program should then display this customer information to the screen with a message that the customer has been added to the customer list.

If the sales associate selects option 2, the program should ask the sales associate for the customer's name, product that the customer is purchasing, the quantity, and the price of the product. The total bill will then be displayed to the screen and should include the following:

- The customer's name.
- The product the customer is purchasing, the quantity, and total cost
- The amount of tax 8%
- The total cost with tax.

Example Total Bill Output:

John Doe

Product Purchased Quantity Total Cost
Shoes 2 $100.00
Tax 8%: $8.00
Total Cost: $108.00

HOW DO I WIITE IT

View Replies View Related

Calculations / Conversions - Calculate Correct Amount Of Change Due To A Customer

Sep 12, 2014

Here are the instructions to my assignment:

A shopkeeper in Diagon Alley needs you to write a program that will calculate the correct amount of change due to a customer. (In Diagon Alley they use three coins with different values, given below).

1. Prompt the user to input the amount of sale in Galleons, Sickles, and Knuts.

2. Prompt the user to input the amount of money given by the customer in Galleons, Sickles, and Knuts.

3. Create constants that represent:

a. 1 Galleon = 17 Sickles

b. 1 Sickle = 29 Knuts

4. Perform the necessary calculations and conversions to compute the correct change in the least number of coins.

5. create a formatted receipt recording the entire transaction.

Here are what is steps 1 and 2 and 5 but problem with are 3 and 4. I need to create the constants and use proper conversions to give the right amount of change back.

Java Code:

import java.util.Scanner;
public class OperatorFormatting {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Welcome to Flourish and Blotts");

[Code] ....

Basically, on steps 3 and 4 which are creating the constants and using the to make the proper conversions to give the customer the proper amount of change Due.

View Replies View Related

Create User Interface That Will Allow Customer To Select Any Category Or Subcategory

Jun 25, 2014

I have a database containing products which are separated in categories and subcategories.I want to create a user interface that will allow the customer to select any category or subcategory and load the products in the main application window.My problem is that i dont like tree do you know any alternative of tree that i can use ?

View Replies View Related

How To Create New Customer Object Each Time User Chooses 1 As Option

Feb 17, 2015

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

public class App {
public static void main(String[] args) throws IOException {
Scanner keyboard = new Scanner(System.in);
System.out.println("Please Select an option > ");

[Code] .....

View Replies View Related

Calculate Cost Of Ticket Order And Display Receipt For Customer On Screen

Oct 4, 2014

Write a program that will calculate the cost of a ticket order and display the receipt for the customer on the screen. There are 2 ticket prices: adult, and senior citizen. Adult seats are $4.50 and senior citizen seats are $3.50. If more than 5 senior citizen tickets are purchased, the customer gets an extra 20% off the of the ticket order. If more than 10 regular seats are purchased, the customer gets an additional 10% off the cost of the order. A customer can only place an order for one type of ticket. Output the type of ticket purchased, the number of tickets purchased, the gross cost, the amount of the discount, and the final cost of the order.

I am having errors with incaompatible varriables comparing float with doubles.

public class lab3 {
  static Library myLib;
  public static void main (String [] args) {
  Library myLib = new Library(); //Instance the Library class
int ticketNum; //Number of Tickets

[Code] .....

View Replies View Related

Three Different Internet Service Provider Packages - Calculate Customer Monthly Bill

Feb 20, 2011

What to do with this JAVA code?

This is the code that I need to do without using the Joptionpane:

An Internet service provider has three different subscription packages for its customers:

Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour.

Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour.

Package C: For $19.95 per month unlimited access is provided.

Write a program that calculates a customer's monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of hours that were used. It should then display the total charges.

This is what I have so far : Cannot use Joptionpaneshowinputdialog

/* A demonstration of how to use Decision Structures

import java.util.Scanner;

/**
This program demonstrates a switch statement.
*/

public static void main(String[] args)
{
char packageLetter;
int hoursUsed;

[Code] ....

View Replies View Related

JOptionPane Cannot Be Resolved

Aug 27, 2014

I Can't run this simple program

import java.util.Scanner;
import javax.swing.JOptionpane;
public class Project {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

[code]...

This is the Error that i get in console!"Exception in thread "main" java.lang.Error: Unresolved compilation problem: JOptionPane cannot be resolved at Project.main(Project.java:10)"

View Replies View Related

GetClass Cannot Be Resolved

Jun 2, 2014

I am trying to read a file that will be contained within the Jar. I have created a source folder in eclipse and put the file in there. The examples I can find online to do this are not working out for me. I am getting an error that getClass cannot be resolved.

Java Code:

private static void help() {
version();
try {
InputStreamReader is = getClass.getClassLoader().getResourceAsStream("data/cmdhelp");
int c;
do {
c = is.read();
System.out.print((char) c);
} while (c > -1);
System.out.println();
} catch (IOException e) {
System.out.println("JAR file has not been packaged correctly.");
}
} mh_sh_highlight_all('java');
The error from eclipse:

getClass cannot be resolvedCommand.java/accface/src/frontendline 29Java Problem

View Replies View Related

StdDraw Cannot Be Resolved?

Mar 2, 2012

I found some code online to draw a pink heart.. sort of a valentine's day heart.. I would like to add to it and customize it some... But I can't get it to work as-is.. I get a compile error that "StdDraw Cannot be resolved" ...

Here is the code..

import java.awt.color.*;
import java.awt.Graphics;
import javax.swing.JPanel;
 
public class Heart {
public static void main(String[] args) {
StdDraw.setXscale(-1.5, +1.5);
 
[Code] .....

View Replies View Related

Random Cannot Be Resolved Or Is Not A Field

Sep 12, 2014

I was given the assignment to make script so that is will fill an array with random numbers using "recyclable" parts.

So my script is:

import java.util.*;
class eser_ha_dibrot_4 {
public static void main(String[] args) {
int []a=new int[10];
fill(a);

[Code] ....

And I get this error: "random cannot be resolved or is not a field"

what to do?

View Replies View Related

JSP :: Add Own Class - ResultSet Cannot Be Resolved To A Type

Mar 27, 2014

I am trying to use a custom class in a .jsp page, as part of a course I am taking on Web Technologies.The original version of the jsp page was working fine, until I moved part of the Java code to a separate class.Here is the original .jsp code that is working:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-GB">
<%@page pageEncoding="utf-8" %>
<head>
<meta charset="UTF-8" />
<title>Forum</title>
<link rel="stylesheet" type="text/css" href="stocktails.css" />
</head>
<body>

[code]....

View Replies View Related

FilterType Cannot Be Resolved - Syntax Error

Mar 9, 2014

I'm not sure why I'm getting these errors. They only begin to happen after the second if statement, and the subsequent if statements are formatted exactly the same.

The errors are marked by the comments in the code.

Java Code:

import java.util.*;
import java.io.*;
public class GazillionSongs {
public static void main(String[] args) throws FileNotFoundException {
System.out.println("Welcome to Java Song Collection!");
System.out
.println("This program sorts and filters large databases of popular songs.");

[Code] .....

View Replies View Related

JSP / JSTL :: OracleDriver Cannot Be Resolved To A Type

Aug 11, 2008

Now I am working with tomcat6.0.16 and oracle10g.

<%@page import="java.sql.*" %>
<%
//Register the drivers
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//Establish connection with the database
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","manager");

[Code] ....

This is my program...then I am getting following error.

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

[Code] ....

View Replies View Related

JSF :: Target Unreachable - Identifier Resolved To Null

Apr 11, 2014

I've created a constructor in bean and put an value to my string after doing so all started to work properly. I am trying to get my application to work but no luck so far. I have looked for similar issues but although there were similar I've got no luck in fixing mine.

When I am trying to put an value in the input file i got error message (/zadanie_1.xhtml @15,75 value="#{z_1.lancuch}": Target Unreachable, identifier 'z_1' resolved to null).

My starting page:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">

[Code]......

View Replies View Related

NewExcel Cannot Be Resolved Into A Type Error Message

May 5, 2014

I am getting the error message as Exception in thread "main" java.lang.Error: Unresolved compilation problems: NewExcel cannot be resolved to a type for the line NewExcel test = new NewExcel(); in the below code to read the columns from an excelsheet "test.xls". Why I am getting the error message :-

import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel

[Code] .....

View Replies View Related

JSF :: Target Unreachable - Identifier Resolved To Null

Jan 7, 2015

I am trying to implement the JSF 2.0 project with Primefaces from one of the tutorial, i con login with only jsf but not when i use primeface where i am getting following error.

Error Log

HTTP Status 500 - /login2.xhtml @23,98 value="#{employee.userName}": Target Unreachable, identifier 'employee' resolved to null type Exception report
message /login2.xhtml @23,98 value="#{employee.userName}": Target Unreachable, identifier 'employee' resolved to null description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: /login2.xhtml @23,98 value="#{employee.userName}": Target Unreachable, identifier 'employee' resolved to null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)root cause

[Code] ....

Note The full stack trace of the root cause is available in the Apache Tomcat/7.0.57 logs. in Apache Tomcat/7.0.57

Employee.java

package com.login.sample;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.annotation.PostConstruct;

[Code] ....

I am trying to create a login page with a database in which i am getting this error. I am not getting this bean properties.

View Replies View Related

JavaFX 2.0 :: Color-lookup Not Resolved In SceneBuilder

Jun 17, 2014

I use SceneBuilder2.0 with JavaFX8 on OSX 10.9.4
 
When i use a stylesheet in SceneBuilder2.0 which uses a color-lookup the lookup fails with:

WARNING: Could not resolve 'abc' while resolving lookups for '-fx-background-color' from rule '*.button' in stylesheet supersimple.css
 
The color-definition is in the root-rule, so it should be found.
 
The lookup does work fine at Runtime.
 
There is a more complete description of the problem on stackoverflow:

javafx - SceneBuilder2.0 does apply rules with color-lookup - Stack Overflow

View Replies View Related

Button Click - Text Area Cannot Be Resolved Or Is Not A Field

Apr 30, 2014

In my application, some text should be added to a text area in response to a click on a button. So as an action listener to this class, I made another class which implements the ActionListener.

Inside this class, I have obtained the text which I want to be added to the text area. But the text area is in another class and for the action listener I wrote another class.

Now the problem is that when I try to add the text to the text area by the following line of code, it says that textArea_1 can not be resolved or is not a field.

Java Code:

ParentPanel.textArea_1.setText("Name:"+ncrarray[0]+"
Code:"+ncrarray[1]+"
Rank:"+ncrarray[2]); mh_sh_highlight_all('java'); What should I do about it?

Even if I try to write a method like the following in the class in which the text area is created, it gives the same error.

Java Code:

public void printTextArea(String text) {
textArea_1.setText(text);
} mh_sh_highlight_all('java');

The text area is present inside a constructor of the class. I am writing the method outside the constructor (ofcourse).

View Replies View Related







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