Billing Utility - Currency Symbol Format
May 19, 2014
package billing.util;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Scanner;
public class CurrencyFormat {
private static final int USD = 0;
private static final int JPY = 1;
[Code] .....
i should be able to use USD, CNY, and JPY. However it seems only the USD ($) will run... doesnt matter which currency symbol the user requests.
View Replies
ADVERTISEMENT
May 19, 2014
Java Code:
package billing.util;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Scanner;
public class CurrencyFormat {
private static final int USD = 0;
[Code] .....
I should be able to use USD, CNY, and JPY. However it seems only the USD ($) will print... doesnt matter which currency symbol the user requests, only the $ will be reprinted....
View Replies
View Related
Feb 17, 2014
I have a form with primefaces input text(p:inputText).Many of the input text values are of the type currency in dollars.When i try to use ,it mandates the user to include $ symbol prepended to the value.Is there any way using which on blur of the field the dollar symbol is prepended and the number gets formatted with proper commas.
View Replies
View Related
Oct 13, 2014
I am working on a program where i calculate a fee using a method. I know i have to import the decimal format utility of java. "import java.text.DecimalFormat;" then i have to create an object for the decimal format. With "DecimalFormat f = new DecimalFormat("0.00");" What i am wondering how do i apply it to my system.out.println statement. I know i have to use for instance f.format(calculateFee()); Is that the right syntax for displaying the results because i generate a syntax error that way.
View Replies
View Related
Jan 27, 2014
How in Java to get the current(overridden) currency symbol from the Windows?
As you know t is possible in Windows (Control Panel->Region->Additional Settings->Currency) change currency symbol to the new one.
For example default is '$' and customer change it to the '€'
And programs (Excel for example) use this new currency symbol, i.e instead of $100 you see €100.
I need emulate similar behavior in Java.
View Replies
View Related
Jan 27, 2014
How in Java to get the current(overridden) currency symbol from the Windows?
As you know you able in Windows (Control Panel->Region->Additional Settings->Currency) change currency symbol to the new one.
And programs (Excel for example) use this new currency symbol.
I need emulate similar behavior in Java.
View Replies
View Related
May 4, 2014
I was told to create a class named Billing that includes three overloaded computeBill methods for a photobook store.
The first method takes the price of the book ordered, adds 8% tax and returns the total due.
The second method takes the price of the book, and the quantity, adds tax and returns the total.
The final method takes the price, quantity and a coupon discount, adds tax and returns the total.
All of this I have managed fairly well, although I keep getting a strange error at the end of my program that the constructor is undefined. The problem bits of code(the one throwing the errors) are under the comment //Enter values into each of the methods
Code:
package org.CIS406.lab2;
public class Billing {
//Declarations
double bookPrice;
int quantityOrdered;
double couponValue;
[Code] ....
My first thought was to create a constructor for each of the methods that I am using...
View Replies
View Related
Nov 7, 2014
I am working on a number of utility functions for square matrices and arrays, and I keep having trouble with segmentation faults.
arrayUtils~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class ArrayUtils {
//This function takes an array a, and returns the sum between indices
//i and j, where i is the lower index and j is the upper index. int size makes
//sure that the function doesn't go out of bounds.
public static int subSum(int[] a,int i, int j) {
int sum=0;
[Code] .....
View Replies
View Related
Jun 30, 2014
I am working through a project in which I am supposed to change dollars into yen with the use of different deposits. I will post the code below that I have been working on.
import java.util.*;
public class DollartoYen {
public static final int MAX_DEPOSITS = 100;
public static final float DOLLAR_TO_YEN = 0.098f;
// read number of Dollars in each account from the keyboard
void readDollars(float[] dollars, int count ) {
[Code] .....
View Replies
View Related
Mar 8, 2014
Just done a quick test to try and figure out the difference between floats and doubles.I made a quick program which outputs the result of 3.3 * 2 as both a float and a double.
I assumed since a float is the larger and more precise of the two data types that there would be more numbers after the decimal point, however this was not the case, it was in fact the double which had more numbers after the decimal point. Result was as follows:
Float: 29.699999
Double: 29.7
BTW for the above code I simply had a few text fields and a button with the following code:
Java Code:
textBox3.setText("" + Float.parseFloat(textBox1.getText()) * Float.parseFloat(textBox2.getText()));
textBox6.setText("" + Double.parseDouble(textBox1.getText()) * Double.parseDouble(textBox2.getText())); mh_sh_highlight_all('java');
Also, as these are limited to a certain amount of numbers im thinking there must be a more precise way for currency, if so what would I use for that? I suppose what im trying to figure out is what data type to use in different scenarios? When to use integer, float, double and long.
View Replies
View Related
Jul 31, 2014
I have been working on making a Java application for the Game RuneScape. My goal is to make an Application to where you register on the application and it saves the information in a file. I am also looking to make it so you can transfer money from Runescape to your Account on my Application by submitting a ticket. When you submit a ticket you get assisted by one of the moderators, they trade you in the game and take the money, and then they take that money out of their current account. Admins are allowed to give moderators money via their account or another method. My issue is creating the ticket system. I want to be able to do this all via the application. So basically what i have currently for the application is a chat room, with different rooms available to go into by the users. So I need to make the tickets show up only to Moderators and Admins in the general chat room.
View Replies
View Related
Jul 26, 2014
I am working with a JFormattedTextField. After adding the text of the FormattedTextField to an LinkedList i want to read it out and sum it up. So I have a problem to convert the String to and integer...
Example:
23.00 - to 23.00
+ 11.00 - to 11.00
--> 34.00
I have tried it with splitting the string but it didn't work. How to do it?
View Replies
View Related
Feb 25, 2014
I want to create a class that converts currency. I stored 2 conversion rate as constant (final) variables. In the main method, I ask the user to enter the amount in US dollars that they want to convert. Then I ask the user to enter the currencyType ("Bitcoin" or "Chuck E Cheese").
However I am stuck in the while loop:
I want to use a while loop that basically does this: If the user entered anything else ( not Bitcoin or Chuck E Chesse), then tell the user to try again, and keep reading Strings until they enter a correct currency type. If the user 3 consecutive incorrect currency types, then exit the program.
Take a look at what I have so far.. when I run the program it does not quite do what I want it to do Also, there's something wrong with one of my if statements and I want to figure out how to fix it.
Java Code:
import java.util.Scanner;
public class CurrencyConverter
{
public static void main(String[] args)
{
System.out.println("----------------------------------");
System.out.println(" Currency Converter");
System.out.println("----------------------------------");
[Code]...
This is how I want my project to look like:
View Replies
View Related
May 10, 2014
So I currently have working code that calculates the denominations that I need when change is displayed. The problem is that it seems to be missing one cents every time. So if my change prints out $12.35, it will end up being 1 - ten, 2 - ones, 1 - quarter, 1 - nickle, and 4 - pennies rather than 2 nickles. or 1 dime This happens for any dollar amount unless it is even cash and no change, or the change calculates to where there doesn't need to be a penny. Just an FYI, this code is being used in a GUI panel program if it seems strange in anyway.
int change1 = (int) ((total - realTotal)*100);
num100 = change1 / 10000;
change1 = change1 % 10000;
String dollar1;
dollar1 = String.valueOf(num100);
[code]....
View Replies
View Related
May 6, 2014
Some method say cannot find symbol like :
jtaAnyText.SetText(intString);
Java Code :
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
public class JTextArea extends javax.swing.JFrame {
[Code] ....
View Replies
View Related
Apr 12, 2015
I am having trouble compiling my simple java program, i keep having this "cannot find symbol"Untitled.jpg but the ODD thing is when i tried to run my code through online java compiler like Ideone.com it compiles perfectly fine. "Check it here".is it because of my jdk? I use the latest jdk 8. and the book I'm following is "Head First Java"..here's my code
class TapeDeck {
boolean canRecord = false;
void playTape() {
System.out.println("tape playing");
}
void recordTape() {
System.out.println("tape recording");
[code]....
View Replies
View Related
Nov 28, 2014
My assignment is to create an ObjectOutputStream object mapped to a binary output file named "ItemRecord_binary.txt". So far I've created a ItemRecord class with a constructor with getters and setters and a override toString method. It compiled. This ItemRecordReport class does not compile because of a can't find symbol error. Here is the code:
import java.io.*;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;
public class ItemRecordReport {
private ObjectOutputStream output;
[code]....
View Replies
View Related
Jul 23, 2014
I have written the below program and while compiling i am getting error. The program and error details goes as follows,
//compute distance of light travels using Java long variable.
class Light {
public static void main(String args[]) {
int lightspeed;
long days;
long seconds;
long distance;
[code]....
I have given the Java file name as 'Light.java'. I have also verified the availability of the java file and compilation path. both are matching. Also, Java file name and class name defined are also same.
View Replies
View Related
Mar 2, 2015
Whenever i try to compile the code, I get " cannot find symbol".
Java Code: public class NinePointOne{
public static void main(String[] args){
Rectangle rec1 = new Rectangle();
}
} mh_sh_highlight_all('java');
View Replies
View Related
Apr 10, 2014
I was given the Java code for a project and I am supposed to build unit tests to test the performance of seven sorting algorithms and I am getting the following error in my Lab1Test file...cannot find symbol: method sorta(int[]) location: class Lab1Test.
Lab1.java
Java Code: package funcollege.comp10062.perflib;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Random;
[code]...
View Replies
View Related
Oct 20, 2014
On line 45 i am trying to add "-" symbol to my output phone number. As of now the out prints like "1800*45*3569377. I want it to print 1800-3569377, or even more ideal: 1-800-356-9377. When printing normally (system.out.println) I can print symbols, but when I try to print from a for-loop it says "unclosed character literal." import java.util.Scanner;
public class Phone_010473030 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a phone number string: ");
String Phone_num = input.nextLine();
Phone_num = Phone_num.toUpperCase();
[code]....
View Replies
View Related
Jan 22, 2014
I keep getting errors, cannot find symbol. Not sure where I am going wrong.
java:139: error: non-static method integerPrompt(String,int,int) cannot be referenced from a static context
int regNumber = integerPrompt("Enter registration number", 100, 5000);
^
Program7.java:145: error: cannot find symbol
theSubject = integerPrompt(SubjectsPrompt, 1, SubjectQty);
^
symbol: variable theSubject
location: class Program7
Java Code:
import java.util.*;
import java.io.*;
import java.util.Scanner;
public class Program7{
public static void main(String args[]){
Student student = new Student();
[Code] .....
View Replies
View Related
Mar 18, 2014
The following two files are in the same directory.Eclipse is the IDE.fix the javac cannot find symbol buildUserInfos error.
package my.proj;
import my.proj.UserInfo;
public class ConvertUser {
//...
public static UserInfo[] buildUserInfos(WebUserInfo[] webUserInfos){
[code]...
View Replies
View Related
Apr 19, 2014
When I put this code in throw new IllegalStateOperation("SortType is invalid"); it states that it can't find the symbol IllegalStateOperation. What should I do to initialize the symbol/variable IllegalStateOperation?
Here is the entire code: :
class HairSalon implements Comparable<HairSalon> {
static final int sortByService = 0, sortByPrice = 1, sortByTime = 2;
private String service;
private double price;
private int time;
[code]...
View Replies
View Related
Feb 3, 2015
I have the following code snipet and I get the following errors
interface expected here
[javac] private class fileFilter implements FileNameExtensionFilter{
[javac] ^
cannot find symbol
[javac] symbol : method fileFilter(java.lang.Object)
[javac] location: class gui.components.StartupDialog
[code]...
View Replies
View Related
Oct 13, 2014
I am new to programing and I am making a dice game where I have to roll two dice and add the total together for each dice (2, 3, 4 ect.) I have all the program finished except one thing.
How would I use the * character that shows the total percentage each number was rolled. Each * will represent 1% of the total rolls. Instead of saying there were ( 4 ) 2's rolled i have to put ( **** ) 2's rolled.
2: ***
3: ******
4: *********
View Replies
View Related