|
The same way you make any type of software.
|
|
|
|
|
A small Off Broadway Theater is opening in Manhattan. The theater consists of an orchestra section and a balcony. The manager purchased a computer for its automated ticket system; and you’ve been awarded the contract to program the test system that will assign seats for the Opening Night of “String Man”.
Your program should display the following choices: Please enter 1 for orchestra and 2 for balcony. If the person types 1, your program will assign a seat in the orchestra section (rows 1-10, 20 seats per row). If the person types 2, your program should assign a seat in the balcony section (rows 11-20, 15 seats per row).
Use a two-dimensional irregular array of primitive type boolean to represent the seating chart of the theater. Initialize all the elements of the array to false to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of the array to true to indicate that the seat is no longer available.
Your program should never assign a seat that has already been assigned. If either the orchestra section or the balcony becomes full, your program should display a message indicating that section is full; and ask the user if they would like a seat in the remaining section. If the user responds, “no”, your program should display the string, “Next performance is in one week”. If both sections are full, your program should display the string, “Sorry, Opening Night is Sold Out”.
When a seat is assigned, your program should print out a ticket indicating the row and seat assignment.
|
|
|
|
|
Member 13189964 wrote: and you’ve been awarded the contract to program the test system That's you, not anyone here. This site is not here to provide free code, or to do your homework assignments.
|
|
|
|
|
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
it could not print the message like bellow
/*
this is the first program
*/
only print
/*
*/
package javaapplication5;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* BufferedReader and Scanner can be used to read line by line from any File or
* console in Java.
* This Java program demonstrate line by line reading using BufferedReader in Java
*
* @author Javin Paul
*/
public class BufferedReaderExample {
public static void main(String args[]) throws IOException{
//reading file line by line in Java using BufferedReader
FileInputStream fis = null;
BufferedReader br = null;
//String line;
try {
fis = new FileInputStream("E:/Sum.txt");
br = new BufferedReader(new InputStreamReader(fis));
String line;
while((line = br.readLine()) != null){
if(line.contains("/*") || line.contains("*/")|| line.contains("//")){
System.out.println(line);
}
else
System.out.println("");
}
br.close();
}
catch(IOException e){
System.out.println("file could not read");
}
}
}
|
|
|
|
|
When I tried to run a code, an error occurred. Please explain why error occurred and how to fix it, thanks.
Here is my code:
import java.util.ArrayList;
class Demo
{
public static void main(String[] args) {
ArrayList<String> list1 = new ArrayList<String>();
ArrayList<String> list2 = new ArrayList<String>();
int index = 0;
list1.add("ahio");
list1.add("bro");
list1.add("higoodbye");
list2.add("hi");
list2.add("goodbye");
for (String x : list1) {
for (String y : list2) {
if (x.contains(y)) {
index = list1.indexOf(x);
list1.set(index, x.replaceAll(y, y.replaceAll("[a-zA-Z]", "*")));
}
}
}
System.out.println(String.join(" ", list1));
}
}
Here is my error:
Warning\Error
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:418)
at java.util.ArrayList.set(ArrayList.java:446)
at Demo.main(Main.java:20)
|
|
|
|
|
The value of index is -1 , which indicates that the element was not found in list1 . You need to check the values of all the variables to see why.
[edit]
In the last case x contains "higoodbye" and y contains "hi" . The search succeeds and the contents of the element in list1 is modified. On the next iteration of list2, y contains "goodbye" so it matches x, but the element in list1 has been modified so the indexOf method returns -1.
[/edit]
modified 1-May-17 3:31am.
|
|
|
|
|
I am trying to use third party sdk or restful api to enable Biometric Authentication in our web based application.
Currently I am checking which will be best and fits the requirement.
Any suggestions please?
|
|
|
|
|
What biometric device will you be using, and how will the user be able to access it?
|
|
|
|
|
HI Everyone! So this is my first post here and I'd like some help from you.
So this method should return all priority Notes but they should be sorted by their priority like the notes with priority 1 comes first and after that priority 2 and so like this. This in an ArrayList
and I've stopped here because I can't figure out how to do ..
Could you please help me with this sortation?
Thanks in advance
<pre>public PriorityNotes[] getPriorityNotes(){
PriorityNotes[] PriorityNotes = new PriorityNotes[notes.size()];
PriorityNotes = notes.toArray(PriorityNotes);
int i;
for(i = 0 ; i < notes.size(); i++){
}
return PriorityNotes;}
|
|
|
|
|
Where is the ArrayList? All I can see in your declaration is a simple array. You should create a proper ArrayList and then use Collections.sort[^] to sort it in order.
|
|
|
|
|
My ArrayList is above all methods ... I've created it
here I just posted this method because I thought you'll understand that I created it
So could you explain how to use the
Collections.sort[^]
?
and where to put this? inside the for loop
|
|
|
|
|
Costea Cornea wrote: So could you explain how to use the
Collections.sort[^] ?
and where to put this? inside the for loop What Richard meant was, that you should only call the sort function on the ArrayList object of yours. Also, you have not shown the structure of your PriorityNote object, does it contain a priority field in itself, or do you assign a value on runtime? If that is a built in field there, then just call the sort function, and to even control how an object is sorted, read java - Sort ArrayList of custom Objects by property - Stack Overflow
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Follow the link I gave you, it explains it there. You do not need a loop since this method sorts the list in place.
|
|
|
|
|
I don't have a field called private Priority_Notes , it shouldn't be it's the task from the class diagram
Ok here I'll give you my fields to see which I have
private int numberOfNotes;
private ArrayList<Note>notes;
and that's all fields which I have
|
|
|
|
|
|
how to make a chat application in java on wan?
|
|
|
|
|
|
hi
I have created a java application(exe).
Now when I try to execute the application from a directory whose name is in unicode(Japanese),it crashes.
I could not figure out the problem ,its showing packager.dll issue.
Please help..
|
|
|
|
|
Since we have no idea where the crash occurs, or what code it is trying to execute, it is impossible to guess.
|
|
|
|
|
Application developed by javafx while build the application it will create this three file with the application exe
msvcp100.dll
msvcr100.dll
packager.dll
then double click the .exe application crash shows the error like
Problem Event Name: APPCRASH
Application Name: SimulatorEndUser.exe
Application Version: 0.0.0.0
Application Timestamp: 55761984
Fault Module Name: packager.dll
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 55761993
Exception Code: c0000005
Exception Offset: 000129a0
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
|
|
|
|
|
Benjamin Bruno wrote: Exception Code: c0000005 means you are trying to access an address that is not in your address space. You will need to use the debugger to find the actual code that causes the error.
|
|
|
|
|
we are working on visa give me a suggetion , and sample code to call the POSLink class?
|
|
|
|
|
|
thanks you for your post is very helpful . I wonder if you could send me your java code for implementing this algorithm. My email address is lamis.guessoum@yahoo.fr Thanks a lot!
|
|
|
|