Project For Reservations At A Restaurant - Set Array In Parameters

May 3, 2015

Okay I am making a class for a reservation project for reservations at a restaurant. So in the end the whole thing has to take reservations, with a GUI and "book" them. For this class of the project I have to add a item to a array (that being name, phone, and so on). I also have to make a sort method.

private static int indexOfMinInRange(Reservations[] a,int low,int high) {
int max=high;
for(int i=high+1;i>=low;i--)
{if()
{max=i;}}
return max;}

[Code] ....

I am working with IndexOfMinInRange method, I don't know whether to set the return type to Reservations, or to set the array in the parameter to Reservations. This is my main problem.

View Replies


ADVERTISEMENT

Table Booking In Restaurant - Declaring 2D Array

Oct 29, 2014

import java.io.*;
public class Booking {
private Customer[] [] booking = new Customer [7] [tables];
private int count = tables;
private String restaurant;

[Code] ......

View Replies View Related

Airplane Seat Reservations - Loop Until User Hits 0

Nov 11, 2014

I'm writing a classic airplane seating program. The program runs fine except for two things:

1) I want the user to exit the program when 0 is inputted (program also quits when all seats are reserved - this works fine already). Now the program quits when user hits blank line with enter. How to fix this and make 0 the exit key?

2) I would like for there to be a line below the seating chart saying that there are XX number of seats available. When user makes reservations, the line should update every time under the seating chart saying that there are such and such number of seats available. How to implement this?

import java.util.*;
public class OmaAirplane {
public static void main(String[] args) {
System.out.println("Welcome to the seat reservation system!");
char[][] seats = new char [8][6];
ArrayList<String> reservedSeats = new ArrayList<>();
for (int i=0;i<8;i++){

[code]....

View Replies View Related

Loop Airplane Seating Reservations Until All Seats Taken Or User Hits 0

Nov 11, 2014

I'm writing a classic airplane seating program. The program runs fine except for two things:

1) I want the user to exit the program when 0 is inputted (program also quits when all seats are reserved - this works fine already). Now the program quits when user hits blank line with enter. How to fix this and make 0 the exit key?

2) I would like for there to be a line below the seating chart saying that there are XX number of seats available. When user makes reservations, the line should update every time under the seating chart saying that there are such and such number of seats available. Any pointers on how to implement this?

import java.util.*;
public class OmaAirplane {
public static void main(String[] args) {
System.out.println("Welcome to the seat reservation system!");
char[][] seats = new char [8][6];
ArrayList<String> reservedSeats = new ArrayList<>();

[Code] .....

View Replies View Related

B-Dimensional Array Shared By Project Jars

Apr 19, 2015

I have several private jars which are linked to my project and I need them to write and read values tofrom the same b-dimensional array. Actually I need a single array which in which my app and its linked jars will write to and read from it. How can I achieve that?

View Replies View Related

Create A Restaurant Ordering System Using JFrame

Oct 14, 2014

How to create a restaurant ordering system using JFrame .....

View Replies View Related

Java Program That Computes Tax And Tip On Restaurant Bill

Feb 4, 2014

I am trying to do this program. it compiles and everything but the numbers are not coming out right. Heres the problem.

Write a program that computes the tax and tip on a restaurant bill. The program should use JOptionPane to ask the user to enter the charge for the meal. The tax should be 6.75 percent of the meal charge. The tip should be 15 percent of the total after adding the tax. Display the meal charge, tax amount, tip amount, and total bill on the screen.

import javax.swing.JOptionPane;
public class Bill {
public static void main(String[] args) {
double mealPurchase = 0;
mealPurchase = Double.parseDouble(JOptionPane.showInputDialog(nul l, " Enter meal total: "));

[Code] .....

View Replies View Related

Assembling Database Project From A Downloaded Project Zip File?

Apr 12, 2014

i downloaded a sample database code of an online payroll system. How can i assemble it to know how it works.
the files include php and mysql files. it is to build an online payroll system

View Replies View Related

Swing/AWT/SWT :: Restaurant Bill Calculator - JFrame Is Not Working

Sep 5, 2014

Why the JFrame is not working

// Project: RestaurantBillCalculator.java Calculates a table's bill.

// Import statements for different classes
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
public class RestaurantBillCalculator extends JFrame

[Code] ....

View Replies View Related

How To Return A String From Project Into Android Project

Jun 26, 2014

I tried many times to return a string from java project to an android project But it keeps sending incorrect values as in 2 as it should be 1 here is an example.

Java Project:

boolean somethingboolean = false;
if(something.equals("1")){
somethingboolean = true;
}
public static String getString(){
if(somethingboolean == true){

[Code]...

Android project:

System.out.println(JavaProject.getString())

and in the android project it prints "FALSE"

So what should i do?

View Replies View Related

JSF :: URL With Get Parameters

Aug 25, 2014

i would like from my bean to redirect after an operation is completed to the page faces/test.xhtml?id=2? Is there a way to do this?

View Replies View Related

How To Put Parameters To Object

Aug 2, 2014

So I created this line class and when I try to create Line object with parameters, I don't know how to pass the parameters properly. It has to return two points, so it should be like [(1,2),(5,12)].I tried different things likeLine l1=new Line(Point p1(1,2),Point p2(5,12)); and similar, but nothing worked.

package line;
import java.awt.Point;
public class Line {
private Point p1;
private Point p2;

[code]...

View Replies View Related

Constructor With Parameters

Jan 31, 2015

public class TestClass {
public TestClass(String k){System.out.println(k);}
public static void main(String[] args) {
try {
hello();
}
catch(Exception e){System.out.println(e);}

[Code] ....

Explain how to catch block act as constructor with parameter?

View Replies View Related

Cannot Get Parameters For If Statement Right?

Mar 1, 2015

I have this JAVA written but I can't get the parameters for the if statements right.

import java.util.Scanner;
public class myFirstJAVA {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Please enter command: ");
String text = input.nextLine();

[Code] ....

View Replies View Related

JSF :: Passing Parameters From Servlet

Sep 12, 2014

I'm trying to pass a parmeter to a jsf page from a servlet(i.e. associated with paypal adaptive api), but I keep getting the following error, even though the productType on ProductDetailsVO is a String.

INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.

sourceId=j_idt2[severity=(ERROR 2), summary=(j_idt2: '45;productType=Sport'

must be a number consisting of one or more digits.), detail=(j_idt2: '45;productType=Sport' must be a number between -2147483648 and 2147483647 Example: 9346)]

Calling JSF page contains:-

returnURL = new URL(new URL(request.getRequestURL().toString()),"pages/paypalpaymentapproved.xhtml?paypalID="+paypalID+";productType=Sport");
response.sendRedirect(returnURL.toString());

[Code] ....

View Replies View Related

Changing Superclass Parameters?

Jul 16, 2014

My understanding was I could override a method from the superclass, including with different parameters, but when I try to use super. it gives me an error the arguments have to match the superclass. But, if I do that it won't make any sense.

The first code below is the superclass. The issue I'm having is on the second code at lines 7 and 10. The ultimate goal is to make a new class where I'm able to display various packages with or without insurance.

public class Package {
double shippingWeight;
public char shippingMethod;
final char air = 'A';
final char truck = 'T';
final char mail = 'M';
double shippingCost;

[code]....

View Replies View Related

Stuck On Constructor With Parameters

Mar 19, 2014

How to use a constructor with parameters where the user inputs the information? I'm doing a problem where I create a Delivery class that accepts arguments for the year, delivery number within the year, distance code (1 for short distance, 2 for long), and weight of package. The constructor is supposed to also determine the eight digit delivery number (combining the year and delivery number, like 20140054 for this year, package #54).

I know I'm not close to being done but I'm struck on the application with the constructor parameters. If I'm asking the user to input the information, does that mean I have to create a no argument constructor so it will compile? Right now it won't compile because it's asking for the parameters but I can't put them.

This is the class:

public class Delivery {
int year;
int delNum;
double weight;
int code;

[Code] .....

And the error is:

CreateDelivery.java:22: error: constructor Delivery in class Delivery cannot be applied to given types;
Delivery firstDelivery = new Delivery();
^
required: int,int,int,double
found: no arguments
reason: actual and formal argument lists differ in length
1 error

View Replies View Related

How To Add Multiple Parameters To ArrayList

Feb 10, 2014

For example, if I have a class called Teacher with the constructor:

public Teacher(double yearsTeaching, boolean isMale, double age)
{
this.yearsTeaching = yearsTeaching;
this.isMale = isMale;
this.age = age;
}

How would I add it to these parameters to my ArrayList in my Tester class?

List<Teacher> teachers = new ArrayList<Teacher>();

View Replies View Related

Using Same Parameters But Different Functions - Allowed Or Not?

Feb 12, 2014

I have made a class here that has two methods. As you guys can notice, in my two methods that I made, I have listed some arguments in there with parameters. My question is that the variables im using in first method, can they be identical on my second method? Is this ok to do?

public class StudentScore {
private int math;
private int science;
private int calc;
private int history;
private int pe;
 
[Code] .....

View Replies View Related

Formal And Actual Parameters?

Jan 11, 2014

In the following Java Code:

public static void f() {
int n = 5;
p(n, 2 * n);
}
public static void p(int a, int b) {
int x = 1;
q(x, a + b);
}
public static void q(int x, int y) {
int z = x + y;
x = 0;
...
} mh_sh_highlight_all('java');

When we write x = 0; that refers to the formal parameter int x and hence it's the formal parameter that changes value. why isn't the value of the actual parameter also changing?

View Replies View Related

BufferedReader - Passing Parameters

Mar 7, 2015

Using Eclipse. I have this line of code:

BufferedReader br = new BufferedReader(new InputStreamReader(in));

I want to do something with br in a method that I defined. But Eclipse is complaining about br declared as

public static void Get_Next(String next_line, BufferedReader br) {

How do I make this work?

View Replies View Related

Repeating Constructors With Same And Different Parameters

May 26, 2014

So while experimenting with constructors, repeating constructors with the same parameters, and with different parameters. I got an output -explaining how I got it.

I made 2 classes. a "support class" (has all the info) and an "execute class" (executes info).

Support:

package inschool;
public class Constructors {
String video;
public Constructors() {
video = "frozen";

[Code] ....

Execute:

package inschool;
//this is part of Constructors class
public class App{
public static void main(String[] args){

[Code] ....

The Output:

the video name is frozen
Second constructor running
Constructor running!
the video name is frozen

Output Explanation:

constructor call number 1 and 3 are the same (essentially) and both refer to the same constructor.

My Question: if both call #1 and #3 refer to the same constructor, why is the output for #1 "the video name is frozen"

while the output for #3 used both methods in the accessed constructor-with the resulting output as
"Constructor running!"
and
"the video name is frozen"

I double checked the output-and this time made sure to scroll up ... its the same result

View Replies View Related

Method Parameters Stubbing

May 31, 2014

I am trying to write a simple test case for one of my web service.The main method

return object :: offersService
MainClass
public OffersService getOffers(String input1, Map input2) {
// userId, Password loaded from another properties files
String response = validateUser(String userId, String Password)

[code]...

View Replies View Related

Objects Being Passed As Parameters

Aug 7, 2014

If I have a method that takes an ArrayList of a class called Piece and it uses the setPosition() method from Piece. It is changing the value of the array that I passed in, but I want the ArrayList to stay the same outside of the method. Is there any way I can change only the values on the inside of the method, but keep the same position values outside the method?Here is an example.

Piece class
Java Code: public class Piece {
private int xCoor;
private int yCoor;

[code]....

View Replies View Related

Declaring Parameters - Use Void For

Mar 1, 2015

I want to have parameters that I use the "void" for, in other words it doesn't return anything.

class code
{
void go()
{
int TestStuff t = new TestStuff();
t.takeTwo(12,34)
}
void takeTwo (int x, int y) {
int z = x + y;
System.out.println("Total is:" + z);
}
}

View Replies View Related

GUI Project Won't Compile

May 6, 2014

I'm doing a project and my code won't compile.

import javax.swing.*;
import java.awt.event.*;
public class BookStore extends JFrame{
private JPanel panel;
private JLabel question; //This will be where the question is.
private JTextField NumofBooks; //this is where the user will enter the number of books
private JButton OKButton,ClearButton,ExitButton; //Will give the user the points, cancel the points, and exit
private final int WINDOW_WIDTH = 310; //Need to make it visible
private final int WINDOW_HEIGHT = 100;

[code]....

View Replies View Related







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