Connecting...

This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to Java
For more information, please see full course syllabus of Introduction to Java
Introduction to Java Input, Output, & Errors
Lecture Description
In this lesson, our instructor Tom Quayle goes through an introduction to input, output and errors. He starts by discussing getting input from and providing output to the user. He then goes on to talk about escape sequences and exception handling.
Bookmark & Share
Embed
Share this knowledge with your friends!
Copy & Paste this embed code into your website’s HTML
Please ensure that your website editor is in text mode when you paste the code.(In Wordpress, the mode button is on the top right corner.)
×
- - Allow users to view the embedded video in full-size.
Next Lecture
Previous Lecture
0 answers
Post by Mirical Williams-Causton on December 1, 2013
do
{
//User inputs whether they want to add a customer, view a customer, or end the program
System.out.println("
Main Menu
1. Add new customer
2. View customer records
3. Exit program");
chChoice = (char) System.in.read();
if (chChoice == '1')
{
//If user chooses choice one, then it would take the user to the add a customer section
System.out.println("You have chosen to add a customer to the current records.");
//Choice One - Add a Customer
//User inputs the customer's name
System.out.println("Enter customer's name: ");
chName = (char) System.in.read();
while ((chName >= 'A' && chName <= 'Z') || (chName >= 'a' && chName <= 'z'))
{
strName += chName;
chName = (char) System.in.read();
}
System.out.println("Customer's Name: " + strName);
}
I am having problems with this code, in high school it's part of a program, and i was applying concepts that we used and what you have taught me but it would go through the choice and when it hits enter customer name, it stops why ?
0 answers
Post by Dante Oakley on September 23, 2013
Victor it is if you are wondering this is very late.
PS- I am a tenth grader taking APCS in high school, this is very brutal :D
1 answer
Last reply by: Dante Oakley
Mon Sep 23, 2013 7:07 PM
Post by Victor Niu on September 8, 2012
When I did the divide by 0 program, it finished successfully, and returned Infinity. Is this a new feature of Java?