Exception in thread “main” java.util.InputMismatchException whats the problemWhat is reflection and why is it useful?How do you assert that a certain exception is thrown in JUnit 4 tests?What is the difference between public, protected, package-private and private in Java?What is a serialVersionUID and why should I use it?What is a plain English explanation of “Big O” notation?What are the lesser known but useful data structures?“implements Runnable” vs “extends Thread” in JavaWhat is a daemon thread in Java?What is a JavaBean exactly?What does “Could not find or load main class” mean?
Is it important to consider tone, melody, and musical form while writing a song?
Why Is Death Allowed In the Matrix?
Can divisibility rules for digits be generalized to sum of digits
How old can references or sources in a thesis be?
What's the point of deactivating Num Lock on login screens?
TGV timetables / schedules?
Why can't I see bouncing of a switch on an oscilloscope?
How do I create uniquely male characters?
Can I make popcorn with any corn?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Writing rule stating superpower from different root cause is bad writing
In Japanese, what’s the difference between “Tonari ni” (となりに) and “Tsugi” (つぎ)? When would you use one over the other?
Why does Kotter return in Welcome Back Kotter?
Test whether all array elements are factors of a number
Email Account under attack (really) - anything I can do?
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
Did Shadowfax go to Valinor?
How could an uplifted falcon's brain work?
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
Why not use SQL instead of GraphQL?
Test if tikzmark exists on same page
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?
Prove that NP is closed under karp reduction?
Exception in thread “main” java.util.InputMismatchException whats the problem
What is reflection and why is it useful?How do you assert that a certain exception is thrown in JUnit 4 tests?What is the difference between public, protected, package-private and private in Java?What is a serialVersionUID and why should I use it?What is a plain English explanation of “Big O” notation?What are the lesser known but useful data structures?“implements Runnable” vs “extends Thread” in JavaWhat is a daemon thread in Java?What is a JavaBean exactly?What does “Could not find or load main class” mean?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I keep getting an error when i run my bank simulation program i will leave the directions with what its supposed to and what code I have written below.
Bank Queues
Write a discreet event simulation of a bank. Data for the simulation is contained in an ASCII file titled bank.txt. The format of the file consists of an unspecified number of lines with each line containing two integers and a string: time_of_entry (integer), transaction_time (integer) and a customer name (string), sorted by ascending time_of_entry. Each field is separated by white space. Sample
0 7 James Bond
0 9 Auric Goldfinger
4 10 Miss Moneypenny
9 4 M
12 6 Q
For each click of the (integer) simulation clock, these actions occur in order
Check if customer enters bank, if so assign a queue
Check if customer completes transaction, if so exits bank.
Check each queue if the teller is free and if so starts transaction.
For each event, output the a message to event long file. The wait time is the difference between when a customer enters the bank and their transaction starts. The simulation continues until all the customers in the file have their transaction completed. The program should output 1) Average wait time 2) maximum wait time, 3) Average Idle time of tellers (time not spent with a customer). 4) Maximum idle time of a teller, 5) total time of the simulation, 6) Teller Efficiency (sum of transaction times/(total time of simulation)
The program should run the same the simulation multiple times with these parameters:
Tellers count of 2, 3, 4, 5
Customers form a queue behind each teller when the enter the bank (choose the shortest one).
Customer join a single wait queue when they enter the bank, they leave the queue when any teller comes open.
For each of the (4*2=8) simulations output the six numbers.
import java.io.File;
import java.util.InputMismatchException;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
class Event
private int time; // time of event
private String type; // type of Event (arrival or departure)
Event()
time = 0;
type = "";
Event(final int time, final String type)
this.time = time;
this.type = type;
public int getTime()
return time;
public void setTime (final int time)
this.time = time;
public String getType()
return type;
public void setType(final String type)
this.type = type;
class ListComparator implements Comparator<Event>
@Override
public int compare(final Event o1, final Event o2)
return o1.getTime() - o2.getTime();
class BankSimulation
private final List<Event> queue;
private int totalWaitingTime;
BankSimulation()
queue = new ArrayList<Event>();
totalWaitingTime = 0;
public void runSimulation() throws FileNotFoundException
final Scanner filereader = new Scanner(new File("/Users/blakethomas/Desktop/Bank.txt"));
int previousDepartureTime = 0;
// until there is input
while (filereader.hasNext())
final Event arrivalEvent = new Event(filereader.nextInt(), "arrival");
final int processingTime = filereader.nextInt();
int departureTime = 0;
if (arrivalEvent.getTime() > previousDepartureTime) // immediate processing
departureTime = arrivalEvent.getTime() + processingTime;
else // wait to get processed
departureTime = previousDepartureTime + processingTime;
previousDepartureTime = departureTime;
totalWaitingTime = totalWaitingTime + departureTime - arrivalEvent.getTime() - processingTime;
final Event departureEvent = new Event(departureTime, "departure");
// add the arrival and departure events to queue.
queue.add(arrivalEvent);
queue.add(departureEvent);
filereader.close();
// sort the list on basis of timings
Collections.sort(queue, new ListComparator());
public void printResults()
System.out.println("nSimulation Begins");
for (final Event event : queue)
if (event.getType().equals("arrival"))
System.out.println("Processing an arrival event at time: " + event.getTime());
else
System.out.println("Processing a deparature event at time: " + event.getTime());
System.out.println("nSimulation Ends");
System.out.println("nFinal Statistics: ");
System.out.println("ntTotal number of people processed: " + queue.size() / 2);
System.out.println("tAverage amount of time spent waiting: " + (float) totalWaitingTime / (queue.size() / 2));
public static void main(final String... args) throws FileNotFoundException
final BankSimulation bankSimulation = new BankSimulation();
bankSimulation.runSimulation();
bankSimulation.printResults();
java data-structures computer-science
add a comment |
I keep getting an error when i run my bank simulation program i will leave the directions with what its supposed to and what code I have written below.
Bank Queues
Write a discreet event simulation of a bank. Data for the simulation is contained in an ASCII file titled bank.txt. The format of the file consists of an unspecified number of lines with each line containing two integers and a string: time_of_entry (integer), transaction_time (integer) and a customer name (string), sorted by ascending time_of_entry. Each field is separated by white space. Sample
0 7 James Bond
0 9 Auric Goldfinger
4 10 Miss Moneypenny
9 4 M
12 6 Q
For each click of the (integer) simulation clock, these actions occur in order
Check if customer enters bank, if so assign a queue
Check if customer completes transaction, if so exits bank.
Check each queue if the teller is free and if so starts transaction.
For each event, output the a message to event long file. The wait time is the difference between when a customer enters the bank and their transaction starts. The simulation continues until all the customers in the file have their transaction completed. The program should output 1) Average wait time 2) maximum wait time, 3) Average Idle time of tellers (time not spent with a customer). 4) Maximum idle time of a teller, 5) total time of the simulation, 6) Teller Efficiency (sum of transaction times/(total time of simulation)
The program should run the same the simulation multiple times with these parameters:
Tellers count of 2, 3, 4, 5
Customers form a queue behind each teller when the enter the bank (choose the shortest one).
Customer join a single wait queue when they enter the bank, they leave the queue when any teller comes open.
For each of the (4*2=8) simulations output the six numbers.
import java.io.File;
import java.util.InputMismatchException;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
class Event
private int time; // time of event
private String type; // type of Event (arrival or departure)
Event()
time = 0;
type = "";
Event(final int time, final String type)
this.time = time;
this.type = type;
public int getTime()
return time;
public void setTime (final int time)
this.time = time;
public String getType()
return type;
public void setType(final String type)
this.type = type;
class ListComparator implements Comparator<Event>
@Override
public int compare(final Event o1, final Event o2)
return o1.getTime() - o2.getTime();
class BankSimulation
private final List<Event> queue;
private int totalWaitingTime;
BankSimulation()
queue = new ArrayList<Event>();
totalWaitingTime = 0;
public void runSimulation() throws FileNotFoundException
final Scanner filereader = new Scanner(new File("/Users/blakethomas/Desktop/Bank.txt"));
int previousDepartureTime = 0;
// until there is input
while (filereader.hasNext())
final Event arrivalEvent = new Event(filereader.nextInt(), "arrival");
final int processingTime = filereader.nextInt();
int departureTime = 0;
if (arrivalEvent.getTime() > previousDepartureTime) // immediate processing
departureTime = arrivalEvent.getTime() + processingTime;
else // wait to get processed
departureTime = previousDepartureTime + processingTime;
previousDepartureTime = departureTime;
totalWaitingTime = totalWaitingTime + departureTime - arrivalEvent.getTime() - processingTime;
final Event departureEvent = new Event(departureTime, "departure");
// add the arrival and departure events to queue.
queue.add(arrivalEvent);
queue.add(departureEvent);
filereader.close();
// sort the list on basis of timings
Collections.sort(queue, new ListComparator());
public void printResults()
System.out.println("nSimulation Begins");
for (final Event event : queue)
if (event.getType().equals("arrival"))
System.out.println("Processing an arrival event at time: " + event.getTime());
else
System.out.println("Processing a deparature event at time: " + event.getTime());
System.out.println("nSimulation Ends");
System.out.println("nFinal Statistics: ");
System.out.println("ntTotal number of people processed: " + queue.size() / 2);
System.out.println("tAverage amount of time spent waiting: " + (float) totalWaitingTime / (queue.size() / 2));
public static void main(final String... args) throws FileNotFoundException
final BankSimulation bankSimulation = new BankSimulation();
bankSimulation.runSimulation();
bankSimulation.printResults();
java data-structures computer-science
It doesn't look like you ever call anything other thannextInt(), so when you get to the name part of the file, you'll be trying to parse something like "Bobby Joe" to an int
– GBlodgett
Mar 8 at 4:00
Welcome to StackOverflow, Blake! Please take some time to read the How to Ask article and take the tour! This questions appears to be a homework assignment and there are some helpful hints you should review when asking for help on that. Also, instead of just saying you have an error, it's very important to include details about the error and show any work you've already done yourself to track down the problem.
– Zephyr
Mar 8 at 4:33
add a comment |
I keep getting an error when i run my bank simulation program i will leave the directions with what its supposed to and what code I have written below.
Bank Queues
Write a discreet event simulation of a bank. Data for the simulation is contained in an ASCII file titled bank.txt. The format of the file consists of an unspecified number of lines with each line containing two integers and a string: time_of_entry (integer), transaction_time (integer) and a customer name (string), sorted by ascending time_of_entry. Each field is separated by white space. Sample
0 7 James Bond
0 9 Auric Goldfinger
4 10 Miss Moneypenny
9 4 M
12 6 Q
For each click of the (integer) simulation clock, these actions occur in order
Check if customer enters bank, if so assign a queue
Check if customer completes transaction, if so exits bank.
Check each queue if the teller is free and if so starts transaction.
For each event, output the a message to event long file. The wait time is the difference between when a customer enters the bank and their transaction starts. The simulation continues until all the customers in the file have their transaction completed. The program should output 1) Average wait time 2) maximum wait time, 3) Average Idle time of tellers (time not spent with a customer). 4) Maximum idle time of a teller, 5) total time of the simulation, 6) Teller Efficiency (sum of transaction times/(total time of simulation)
The program should run the same the simulation multiple times with these parameters:
Tellers count of 2, 3, 4, 5
Customers form a queue behind each teller when the enter the bank (choose the shortest one).
Customer join a single wait queue when they enter the bank, they leave the queue when any teller comes open.
For each of the (4*2=8) simulations output the six numbers.
import java.io.File;
import java.util.InputMismatchException;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
class Event
private int time; // time of event
private String type; // type of Event (arrival or departure)
Event()
time = 0;
type = "";
Event(final int time, final String type)
this.time = time;
this.type = type;
public int getTime()
return time;
public void setTime (final int time)
this.time = time;
public String getType()
return type;
public void setType(final String type)
this.type = type;
class ListComparator implements Comparator<Event>
@Override
public int compare(final Event o1, final Event o2)
return o1.getTime() - o2.getTime();
class BankSimulation
private final List<Event> queue;
private int totalWaitingTime;
BankSimulation()
queue = new ArrayList<Event>();
totalWaitingTime = 0;
public void runSimulation() throws FileNotFoundException
final Scanner filereader = new Scanner(new File("/Users/blakethomas/Desktop/Bank.txt"));
int previousDepartureTime = 0;
// until there is input
while (filereader.hasNext())
final Event arrivalEvent = new Event(filereader.nextInt(), "arrival");
final int processingTime = filereader.nextInt();
int departureTime = 0;
if (arrivalEvent.getTime() > previousDepartureTime) // immediate processing
departureTime = arrivalEvent.getTime() + processingTime;
else // wait to get processed
departureTime = previousDepartureTime + processingTime;
previousDepartureTime = departureTime;
totalWaitingTime = totalWaitingTime + departureTime - arrivalEvent.getTime() - processingTime;
final Event departureEvent = new Event(departureTime, "departure");
// add the arrival and departure events to queue.
queue.add(arrivalEvent);
queue.add(departureEvent);
filereader.close();
// sort the list on basis of timings
Collections.sort(queue, new ListComparator());
public void printResults()
System.out.println("nSimulation Begins");
for (final Event event : queue)
if (event.getType().equals("arrival"))
System.out.println("Processing an arrival event at time: " + event.getTime());
else
System.out.println("Processing a deparature event at time: " + event.getTime());
System.out.println("nSimulation Ends");
System.out.println("nFinal Statistics: ");
System.out.println("ntTotal number of people processed: " + queue.size() / 2);
System.out.println("tAverage amount of time spent waiting: " + (float) totalWaitingTime / (queue.size() / 2));
public static void main(final String... args) throws FileNotFoundException
final BankSimulation bankSimulation = new BankSimulation();
bankSimulation.runSimulation();
bankSimulation.printResults();
java data-structures computer-science
I keep getting an error when i run my bank simulation program i will leave the directions with what its supposed to and what code I have written below.
Bank Queues
Write a discreet event simulation of a bank. Data for the simulation is contained in an ASCII file titled bank.txt. The format of the file consists of an unspecified number of lines with each line containing two integers and a string: time_of_entry (integer), transaction_time (integer) and a customer name (string), sorted by ascending time_of_entry. Each field is separated by white space. Sample
0 7 James Bond
0 9 Auric Goldfinger
4 10 Miss Moneypenny
9 4 M
12 6 Q
For each click of the (integer) simulation clock, these actions occur in order
Check if customer enters bank, if so assign a queue
Check if customer completes transaction, if so exits bank.
Check each queue if the teller is free and if so starts transaction.
For each event, output the a message to event long file. The wait time is the difference between when a customer enters the bank and their transaction starts. The simulation continues until all the customers in the file have their transaction completed. The program should output 1) Average wait time 2) maximum wait time, 3) Average Idle time of tellers (time not spent with a customer). 4) Maximum idle time of a teller, 5) total time of the simulation, 6) Teller Efficiency (sum of transaction times/(total time of simulation)
The program should run the same the simulation multiple times with these parameters:
Tellers count of 2, 3, 4, 5
Customers form a queue behind each teller when the enter the bank (choose the shortest one).
Customer join a single wait queue when they enter the bank, they leave the queue when any teller comes open.
For each of the (4*2=8) simulations output the six numbers.
import java.io.File;
import java.util.InputMismatchException;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
class Event
private int time; // time of event
private String type; // type of Event (arrival or departure)
Event()
time = 0;
type = "";
Event(final int time, final String type)
this.time = time;
this.type = type;
public int getTime()
return time;
public void setTime (final int time)
this.time = time;
public String getType()
return type;
public void setType(final String type)
this.type = type;
class ListComparator implements Comparator<Event>
@Override
public int compare(final Event o1, final Event o2)
return o1.getTime() - o2.getTime();
class BankSimulation
private final List<Event> queue;
private int totalWaitingTime;
BankSimulation()
queue = new ArrayList<Event>();
totalWaitingTime = 0;
public void runSimulation() throws FileNotFoundException
final Scanner filereader = new Scanner(new File("/Users/blakethomas/Desktop/Bank.txt"));
int previousDepartureTime = 0;
// until there is input
while (filereader.hasNext())
final Event arrivalEvent = new Event(filereader.nextInt(), "arrival");
final int processingTime = filereader.nextInt();
int departureTime = 0;
if (arrivalEvent.getTime() > previousDepartureTime) // immediate processing
departureTime = arrivalEvent.getTime() + processingTime;
else // wait to get processed
departureTime = previousDepartureTime + processingTime;
previousDepartureTime = departureTime;
totalWaitingTime = totalWaitingTime + departureTime - arrivalEvent.getTime() - processingTime;
final Event departureEvent = new Event(departureTime, "departure");
// add the arrival and departure events to queue.
queue.add(arrivalEvent);
queue.add(departureEvent);
filereader.close();
// sort the list on basis of timings
Collections.sort(queue, new ListComparator());
public void printResults()
System.out.println("nSimulation Begins");
for (final Event event : queue)
if (event.getType().equals("arrival"))
System.out.println("Processing an arrival event at time: " + event.getTime());
else
System.out.println("Processing a deparature event at time: " + event.getTime());
System.out.println("nSimulation Ends");
System.out.println("nFinal Statistics: ");
System.out.println("ntTotal number of people processed: " + queue.size() / 2);
System.out.println("tAverage amount of time spent waiting: " + (float) totalWaitingTime / (queue.size() / 2));
public static void main(final String... args) throws FileNotFoundException
final BankSimulation bankSimulation = new BankSimulation();
bankSimulation.runSimulation();
bankSimulation.printResults();
java data-structures computer-science
java data-structures computer-science
asked Mar 8 at 3:58
Blake ThomasBlake Thomas
1
1
It doesn't look like you ever call anything other thannextInt(), so when you get to the name part of the file, you'll be trying to parse something like "Bobby Joe" to an int
– GBlodgett
Mar 8 at 4:00
Welcome to StackOverflow, Blake! Please take some time to read the How to Ask article and take the tour! This questions appears to be a homework assignment and there are some helpful hints you should review when asking for help on that. Also, instead of just saying you have an error, it's very important to include details about the error and show any work you've already done yourself to track down the problem.
– Zephyr
Mar 8 at 4:33
add a comment |
It doesn't look like you ever call anything other thannextInt(), so when you get to the name part of the file, you'll be trying to parse something like "Bobby Joe" to an int
– GBlodgett
Mar 8 at 4:00
Welcome to StackOverflow, Blake! Please take some time to read the How to Ask article and take the tour! This questions appears to be a homework assignment and there are some helpful hints you should review when asking for help on that. Also, instead of just saying you have an error, it's very important to include details about the error and show any work you've already done yourself to track down the problem.
– Zephyr
Mar 8 at 4:33
It doesn't look like you ever call anything other than
nextInt(), so when you get to the name part of the file, you'll be trying to parse something like "Bobby Joe" to an int– GBlodgett
Mar 8 at 4:00
It doesn't look like you ever call anything other than
nextInt(), so when you get to the name part of the file, you'll be trying to parse something like "Bobby Joe" to an int– GBlodgett
Mar 8 at 4:00
Welcome to StackOverflow, Blake! Please take some time to read the How to Ask article and take the tour! This questions appears to be a homework assignment and there are some helpful hints you should review when asking for help on that. Also, instead of just saying you have an error, it's very important to include details about the error and show any work you've already done yourself to track down the problem.
– Zephyr
Mar 8 at 4:33
Welcome to StackOverflow, Blake! Please take some time to read the How to Ask article and take the tour! This questions appears to be a homework assignment and there are some helpful hints you should review when asking for help on that. Also, instead of just saying you have an error, it's very important to include details about the error and show any work you've already done yourself to track down the problem.
– Zephyr
Mar 8 at 4:33
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056510%2fexception-in-thread-main-java-util-inputmismatchexception-whats-the-problem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056510%2fexception-in-thread-main-java-util-inputmismatchexception-whats-the-problem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It doesn't look like you ever call anything other than
nextInt(), so when you get to the name part of the file, you'll be trying to parse something like "Bobby Joe" to an int– GBlodgett
Mar 8 at 4:00
Welcome to StackOverflow, Blake! Please take some time to read the How to Ask article and take the tour! This questions appears to be a homework assignment and there are some helpful hints you should review when asking for help on that. Also, instead of just saying you have an error, it's very important to include details about the error and show any work you've already done yourself to track down the problem.
– Zephyr
Mar 8 at 4:33