The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 397 Weeks Ago, 2 Days Ago |
| Questions Answered: | 1850 |
| Tutorials Posted: | 1850 |
Graduate in Biology and Nutrition, MBA Finance
Florida State University
Aug-2000 - Jul-2007
Ass. Relationship Manager
Penn-Florida
Mar-2009 - Feb-2016
I am having some issues with my assignment for IT 511 (Object Oriented Application Development). When I go to test the following code I receive numerous errors and I am not sure why
package message.array;
import java.util.Scanner;
/**
*
* @auth gregory.hauptman
*/
public class ShoutBox {
public static void main(String[] args) {
String[] messages = new String[10]; //declaring 10 arrays
messages[0] = "Today is May 2, 2017";
messages[1] = "This year is almost half over";
messages[2] = "The weather is beautiful today";
messages[3] = "Why is the weather always nice when I have to work?";
messages[4] = "Hopefuly the weather is beautiul tomorrow";
messages[5] = "I am learning the Java programming language";
messages[6] = "Hacksaw Ridge was a great movie!";
messages[7] = "I am looking forward to Red Dead Redemption 2 later this year";
messages[8] = "It's good to have family and friends near by";
messages[9] = "This is the final project for this course";
String m = new ShoutBox().shoutOutCannedMessage(messages); //place the messages in the shoutbox
System.out.println(m);
}
public String shoutOutCannedMessage(String[] messages){
Scanner in = new Scanner(System.in);
for(int i = 0; i < messages.length; i++){ //creates a number to relate each of the messages
System.out.println(i+ ". " +messages[i]); //Print out the messages with number assignment
}
System.out.println("Please choose a message");
int idx = in.nextInt(); //copies the array an allows the answer to be input
String message = messages[idx]; //allows the program to match the number to the message
return message; //prints out the message associated with the selected number
}
}
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â----------- -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I