What is the "shoutOutCannedMessage" method? - java

I am trying to do a homework assignment where the application asks the user to input 10 strings, then displays them all, and finally ask the user to select 1 to display a second time. For extra credit, I'm using a HashMap (named shout) to store the data instead of an ArrayList.
My professor wants me to output the 10 strings using the shoutOutCannedMessage() method.
MY QUESTION: What is the shoutOutCannedMessage() method and how do I use it in this situation? Why can't I just do System.out.println(shout);, which worked completely fine when I tried it?
I cannot find anything online about this method in terms of a general description, cannot find it anywhere in our textbook, etc.
I tried shoutOutCannedMessage(shout); to no avail. I get the error message:
cannot find symbol
symbol: method shoutOutCannedMessage(HashMap<Integer,String>)
location: class ShoutBox
This is for an online class so we don't have lectures and it'd take 48 hours to get a response via email from the professor. I've been trying to watch thenewboston's video tutorials to guide me through this class and haven't found anything relevant to this assignment.
SECOND QUESTION: How do I then proceed to have a user select just one key from the HashMap to be displayed, using the shoutOutCannedMessage() method?
Thank you very much to anybody who offers assistance!
EXACT ASSIGNMENT INSTRUCTIONS:
You will create the ShoutBox class for your Virtual World. Your ShoutBox class will have a shoutOutCannedMessage() method that returns a String type. The shoutOutCannedMessage will use an Array or an ArrayList to store 10 messages of type String. For those of you that are more advanced with your Java skills, you could use a HashMap for the data structure. You can load this data structure with 10 messages of your choosing. For example, one message could be “I need Java!” You can initialize your Array or ArrayList with the messages or have the user enter the messages. The choice is yours. The shoutOutCannedMessage() will loop through the data structure to first display all canned messages and allow the user to select one. The shoutOutCannedMessage() will return the selected message String.

I think you are missing a key concept in this lesson. The instructor wants YOU to implement the shoutOutCannedMessage() method. Of course you can't find it anywhere online, etc. because your professor made up the name for this method. It is your homework to implement it and code the method. It should be easy enough as you are using the HashMap so each time the user enters in a string it'll be put into the Hash. Then just ask the user which one they want to repeat, by entering in an integer, and if you've coded things properly it will then output their selection.

Related

Java- MySQL: Barcode scan to alter field in db

I am new to Java and MySQL, and I want to build my first app. So, I run into a few problems at the start. Two of them to be precise...
I want to make an app (for free), to support a local Board game club, and here is the catch.
The club wants to use Barcode scanner to read barcode in their member's membership cards. This should alter a field in their database, which is 'bit' type, corresponding to member being in the club, or not (with 1 being active, and 0 being away).
Other thing is, the member should be 'active' for the whole day, and his 'activity' should reset at the end of a day.
I was thinking of making it a session, but how do I make it expire at the exact time?
Now, I have looked for answers in other questions, but have found nothing of use...
I am here for further clarifications if needed...
Thank you in advance :)
The barcode scanner is, for the most part, just a keyboard replacement. Instead of typing the code by hand, the scanner will send the keystrokes for you. You don't really need to do anything about it.
I assume the barcode represents member ID. When your application reads a barcode, it should then do something like this: update members set active=1 where member_id = xxx, with xxx being the barcode.
At the end of the day, you want to check all members out. You'll do something like this: update members set active=0 where active=1. Depending on your situation, you can either make a button to run this action, or you can make a cron job/task schedule that will run at some fixed time.

How to store multiple data string in a Parse Object with android

I am making an application in which a user A shares some information with selected people/users B,C,D and E for example. User A login from his device and asks B,C,D and E's opinion about a certain product. B,C,D and E can provide feedback in positive or negative. So how can I create a list of users that is stored under the same title of the instant and how can I record aNd manage their feedback as well. Should I create a Parse Array of users for this purpose? I hope you understand my question. I tried to be as descriptive as possible. Best :)
What I have tried:
I have created two parse objects. One for the user who creates the instance and other for those with whom the information is shared with. Is that fine or should there be a simpler way to do it?

When will I need to serialize an object?

I recently watched a tutorial about serializing objects in java, but it left me wondering when can I use this?
From what I understand, the object is converted into a file, which can be converted back by another program, but could I not program the object into the other program? Please explain what this could be used for, thanks!
Example:
A user logs in to a game launcher , the launcher gets the user details and saves it as a serialized object.
When the user starts the game, the game looks for the file, gets the object and doesn't have to look online , that way the game starts much faster.
Hope you understand the use of it :)

How to control another program in your own java written program?

I wanted to ask you somewhat simple question in Java lang using Eclipse, as I learned C# language about 2 years, about a couple days I started directly learning this language (Java), now all I am doing is writing a simple programs, like the one I am working on at this minute, it's like a master password program that takes your ID and password for facebook and gmail and hotmail , and then promopts you to type your own short simple name and password which will save your time and make it easier for you to log into any log-in required site, therefore avoiding the Key-loggers (Spyware)....
I wrote my program that runs another program like Messenger, I'm now almost done, all I need how can I give commands or pass String variables to the textboxes in the windows of the msn messenger program, this is the line I tried to pass variables like the input ID goes to the Username textbox in the messenger, and also the same for pass input...
Things I wish You tell me also: how do i make a saved file that will not repeat the first inputs like your original password, i mean that the next use will take you just to type your ID and master pass, and also how do i control the programs with more than pasting a strings.
Use java.awt.Robot to find the MSN Messenger window and type into.

Where to start for my java program (Using the folder names to get info from IMDB)

I finished first year comp sci. And i want to spend some time working on the things they have taught us in the first year (lot of java and a bit of C)...
Anyways as a project, i wanted to do something i need, and what i need is a program to run through my movie folder and get the ratings and some basic info from IMDB...
I'm not sure where to start, i think i can handle the parts about reading the folder names, getting rid of the junk from the name to get the actual name and stuff.. Also i can handle the GUI but i don't know how i can talk to IMDB... what steps should i take to complete this project. I have about a month before school starts and i want to finish it before then...Thanks for all the input
EDIT:
Also can you guys tell me what i should start with and then move on to what? As in should i start with the GUI first or have the code that reads in the folder names and filters the names... I only wrote one program as an assignment in school and it was basically outlined step by step so i just wanna know what i should start with
You've made a very good start by decomposing the problem, identifying the kind of components you need and focusing on (an important) one that you don't know how to do.
The IMDB API is documented here and you can see that it amounts to sending simple HTTP requests with some paramters and getting back some formatted data, possibly as a JSON string.
You will find libraries to help with doing those two things. Even if there are public domain wrappers for accessing IMDB I'd recommend attempting to use general purpose HTTP and JSON libraries - that's probably a better educational exercise.
I'm the author of the IMDB API you are dicussing ;) I limit requests to 30 per hour to stop people hammering. I have yet to have a legitimate reason to perform more requests than that. My suggestion to anyone is to write a batch script to perform 1 request every 2minutes and then leave it going for a few hours overnight. Then you only have to perform a request on demand whenever you add a new movie.

Categories

Resources