Write A Sales Tax Program With JOptionpane / Illegal Start Of Expression
Oct 19, 2014
I'm trying to write a sales tax program with JOptionpane but I received this message: illegal start of expression
import javax.swing.JOptionPane;
public class SalesTax {
public static void main(String[] args) {
String amount;
double stateSalesTax;
double countySalesTax;
double totalSalesTax;
double totalSaleAmount;
double amt;
JOptionPane.showInput.Dialog("Enter the amount of purchase");
[code]....
View Replies
ADVERTISEMENT
Apr 11, 2013
class Test1
{
public static void main(String args[])
{
void show()
{
System.out.print("its working");
}
show();
}
}
When I compile this program i find the error illegal start of expression
^void show
Test1.java5 ';' is expected
View Replies
View Related
May 4, 2015
package com.example;
import com.example.domain.Admin;
import com.example.domain.Director;
[Code]....
View Replies
View Related
Jul 30, 2014
How that's possible
import java.util.*;
public class Stars {
public static void main(String[] args) {
line (13);
line (7);
line (35);
System.out.println();
box(10,3);
[Code] ....
View Replies
View Related
Aug 20, 2014
I am getting the error "Line 54, illegal start of expression". Line 54 is where my "for" starts. It was running ok earlier, now I can't get this error to go away?
public static void main(String[] args) {
double salary;
double commission;
double totalSales;
double annualComp;
double salesTarget;
double incentive;
double accel;
double incentive1;
double notAccel;
double increment;
[code]....
View Replies
View Related
Mar 17, 2014
Lines 7 , 10 ,13 .... All have a Illegal Start of Expression error.
[color=blue]private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Random rd = new Random();
int random = 0;
random=rd.nextInt(6)+1;
switch(random){
[Code] ....
View Replies
View Related
Jul 21, 2014
why the complier is giving the following error message "illegal start of expression" once it reach the countSpaces method.The way I see it (and I am obviously seeing it wrong), the code is public since why not, int since it returns an int # and the method has return int in it, and static I am not too sure but I get the same error message whether or not it is included
public static void main (String args[]) {
Scanner in = new Scanner(System.in);
String sentence;
System.out.println("type a sentence");
sentence = in.nextLine();
countSpaces (sentence);
[code]....
View Replies
View Related
May 4, 2015
Why does this not work? I get an ']' expected at the y in the fourth line of code and an illegal start of an expression at the actual ] in the same line
int y = 0;
JTextField response[] = new JTextField[10];
while(y < 10) {
JTextField response[y] = new JTextField(7);
add(response[y]);
response[y].addItemListener(this);
++y; }
View Replies
View Related
Jun 11, 2014
I keep getting this error upon compiling and can't see the problem with it.
The error is on line "45: 15"
/* 37: */ public static EntityDef forID(int i)
/* 38: */ {
/* 39: 10 */ for (int j = 0; j < 20; j++) {
/* 40: 11 */ if (cache[j].type == i) {
/* 41: 12 */ return cache[j];
[Code] .....
View Replies
View Related
Nov 1, 2014
Here is my program and results and I am having a error on line 38 which is "public static long fib01(long paramLong)" The program does give me my results but I am trying to correct there error.
public static void main(String[] args) {
{
System.out.print("
" + String.format("%-10s", new Object[] { "Index" }));
System.out.print(String.format("%-15s", new Object[] { "Fibonacci01" }));
System.out.print(String.format("%-15s", new Object[] { "Fibonacci02" }));
System.out.println(String.format("%-15s", new Object[] { "Fibonacci01" }));
[Code] ....
Index Fibonacci01 Fibonacci02 Fibonacci01
--------------------------------------------------
0 0 0 0
1 1 1 1
2 1 1 1
3 2 2 2
4 3 3 3
5 5 5 5
6 8 8 8
7 13 13 13
8 21 21 21
9 34 34 34
10 55 55 55
11 89 89 89
12 144 144 144
13 233 233 233
14 377 377 377
15 610 610 610
16 987 987 987
17 1597 1597 1597
18 2584 2584 2584
19 4181 4181 4181
20 6765 6765 6765
21 10946 10946 10946
22 17711 17711 17711
23 28657 28657 28657
24 46368 46368 46368
25 75025 75025 75025
26 121393 121393 121393
27 196418 196418 196418
28 317811 317811 317811
29 514229 514229 514229
30 832040 832040 832040
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - illegal start of expression
at fibonacci.Fibonacci.main(Fibonacci.java:38)
--------------------------------------------------Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
View Replies
View Related
Jun 3, 2014
I'm working on a program and can't seem to fix my for loop error.I get an error at the for loop line saying illegal start of expression and i don't know how to fix it:
/*
* 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 million;
import java.util.Scanner;
public class Million {
[code]....
View Replies
View Related
Jul 1, 2014
I need to know why this program is giving me error (illegal start of expression). What must i do to stop the error?
//Read a character from keyboard
class Kbin{
public static void main(String[]args){
throws java.io.IOException{
char ch;
System.out.print( " Press a key followed by ENTER: ");
ch = (char) System.in.read();//read character from keyboard
System.out.println( "Your key is: " + ch);
}
}
}
View Replies
View Related
Jan 10, 2014
Here is the code
public static void main(String[] args) {
Scanner Keyboard = new Scanner(System.in);
System.out.print("Please enter your name.");
String name = Keyboard.next();
name = "name";
[Code] ....
View Replies
View Related
Oct 15, 2014
I'm attempting to create a program that employs a method to count the number of 7s a user puts as an input into the program. I'm just getting started, but I'm getting an error when I try to implement a main method that says "Illegal start of expression"
What adjustments could I make to eliminate this error message?
// Add a main method here.
public static void main(String[] args) {
//Error occurs here
public static int countSevens(int n) {
// 0. Clean-up. Get rid of any minus signs as that is not a digit.
n = Math.abs(n);
[Code] .....
View Replies
View Related
Mar 5, 2014
This specific assignment requires me to write a program that calculates the total sales after each football game. There are 4 types of tickets: box, sideline, premium, and general admission. After each game, data is stored in a file... then output the number of tickets sold and total sale amount. Format your output with 2 decimal places.
Okay I know there is a I/O section and wasnt sure where to post this. I need some insight on how to use file input and output as well ... Here is my program:
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class ticketsSold
{
public static void main(String[] args)
{
String BoxSeat;
String SideLine;
[Code] ....
View Replies
View Related
Apr 21, 2015
Where are all these illegal start of operations and all of these other method errors coming from.I've written enough methods not to have this problem.
----jGRASP exec: javac -g Assessement.java
Assessement.java:29: error: illegal start of expression
public void addQuestionAnswer(){
^
Assessement.java:29: error: illegal start of expression
[code].....
View Replies
View Related
Aug 6, 2014
I'm working through Head First Java, and I'm struggling with the chapter 6 magnet exercise on page 161. I've checked my answer countless times, and it appears to match the book's code, but when I try to run it on my computer I'm getting an error. It says:
error: <identifier> expected
System.out.println^(" "); and
error: illegal start of type
System.out.println(^" ");, both for line 32.
I cannot seem to figure out what is different about my code!!
import java.util.*;
public class ArrayListMagnet {
public static void main (String [] args) {
ArrayList<String> a = new ArrayList<String>();
a.add (0, "zero");
a.add(1, "one");
a.add(2, "two");
a.add(3, "three");
[Code] .....
Also, I'm not sure if this has anything to do with the above errors, but I'm getting a third error message for line 34 saying:
error: class, interface, or enum expected
}^.
View Replies
View Related
Jul 17, 2014
I'm trying to create a code with case commands but it says that public is an illegal start of statement, What do i do?
View Replies
View Related
Oct 9, 2014
i have to ask user gross sales until -1 sentinial and to get the commission to put in groups its 9% times the sales add $200
the groups are formatted
a) $200-299
/> $300-399
....
i) $1000 and over
import java.util.Scanner;
public class Commissions {
/**
* @param args
[Code]....
View Replies
View Related
Jun 29, 2014
Design a program that will read a file of sales records and produce a sales report. Each record in the file contains a customer's ID, name, a sales amount, and a validated GST code. The GST code is to be applied to the sales amount to determine the sales tax due for that sale, as shown below.
GST CodeGST Rate
0
1
20%
5%
10%
The report is to print a heading "SALES REPORT", and detail lines listing the customer's ID, name, sales amount, sales tax, and total amount due including sales tax.
Is assignment
sofar:pseudo code
SalesReport
Read customer file
Get TaxCode
Get GSTAmount SalesTax
Calculate SalesTax
[Code] ....
View Replies
View Related
Apr 3, 2014
{
public static void main (String []args)
{
Scanner numberin = new Scanner (System.in);
double store [];
[Code]....
How would I get my program to display a * for every 100 dollars in sales that the user enters in so: for example the user enters in store 1: $ 400 in sales for the store I want it to display store 1:****
The first part of my code allows the user to enter in whatever values the stores have in sales. The Second half of the code starts at line 19 is my best guess on what I need to do I just am not sure how to get it to display what I need it to.
View Replies
View Related
Nov 7, 2014
my project is to design a class that stores the number of units sold and has a method that returns the total cost of the purchase..the given info is unit are $99. discounts are 20% for 10-19 units; 30% for 20-49 units; 40% for 50-99 units; and 50% for 100 or more units purchased... When i run the code and put in the units sold it returns: 0 units sold, $0.00 cost, 0% discount. How do I get the output to actually do the equation and give proper information. We were given a demo file from the instructor and had to create a class that works with it first set of code is the demo file:
package chapter4;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
* SoftwareSalesDemo Program
*/
public class SoftwareSalesDemo {
public static void main(String[] args) {
int units; // To hold units sold
[code]....
View Replies
View Related
Sep 13, 2014
The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets: box, sideline, premium, and general admission. After each game, the data is stored in a file in the following format:
ticketPrice numberOfTicketsSold
Sample data might look like:
250 5750
100 28000
50 35750
25 18750
The first line indicates that the box ticket price is $250 and that 5750 tickets were sold at that price.
Your program should input in this data (using Scanner or an input dialog box), then output that data to a message dialog box along with total ticket sales information. Output the total number of tickets sold and the total sale amount. Make your output user-friendly and "pretty". Format your output with two decimal places. Use JOptionPane and the formatting techniques learned in chapter 3 for your output. Example output might be:
5750 Box Tickets sold at $250.00
28000 Sideline Tickets sold at $100.00
35750 Premium Tickets sold at $50.00
18750 General Admission tickets sold at $25.00
View Replies
View Related
Jul 24, 2014
The area of a square is stored in a double variable named area . Write an expression whose value is length of the diagonal of the square. Do I use math.sqrt?
View Replies
View Related
Oct 16, 2014
I am new to making an installer so far i have made only one and i used "install creator"
I just make a watch (clock) application and i want when the windows start its also starts automatically except if it is closed by the user
just like widows clock widget.
View Replies
View Related
Jul 21, 2014
How do i write a program using textEdit? I can't even get the examples to open?
View Replies
View Related