Implement a for loop in the application

Assignment Help JAVA Programming
Reference no: EM131074262

Here's the prompt and I've included my code for what i've done so far at the bottom.

I need to figure out how to make the math.Random

statement output into behaviors (reading, writing, drawing)

You will need to:

1. create a method in the class student that returns what the student is doing

2. this method have to generate the behavior randomly. It can't return the same thing every time.

3. implement a for loop in the application to call for the student behavior for 20 times

1.) create a method called whatsUp( ) in the student class. This method is going to return what the student is doing in class. At first, make it return always the same thing, a String for instance, "surfing the web". Later I will suggest how to return different things.

2. Change the app: include a for loop such as:

for (int j = 1; j < 20; j++)
{
// here, display what the student is doing using the whatsUp( ) method
// You should know how to do create an instance of a student,
// and display some basic information
}

3. If you made till here and read my example with random numbers above, try to change the whatsUp method so that it returns different behaviors randomly

public static void main(String[] args) {

String firstName1 = "Jon";
String lastName1 = "Snow";
double x;
//behavior = st.whatsUp();

for (int i=0; i x = Math.random();
System.out.println("My Random number" + x);
}
}
private String behavior (double x) {

return "hello";
}
}

if (behavior.matches("reading"))
{
i++;
}
if (behavior.matches("writing"))
{
j++;
}
if (behavior.matches("drawing"))
{
k++;

Reference no: EM131074262

Questions Cloud

Defining a problem : The first stage of the project is to select a topic, begin preliminary research, define the rhetorical situation (subject, purpose, readers, and context of use), and describe the problem. This is a pre-writing assignment designed to help you start..
Passionate shepherd to his love : Assignment: Analyze and write 750 words on the poem above from the assigned readings using one of the following critical approaches (NOT reader response or biographical criticism)
Meaning of the poem change : Did the meaning of the poem change when the lines were divided differently? How? How did the rhythm of reading the poem change? What have you learned about line and stanza division through doing this activity?
Does the information media have social responsibility : Does the information media have social responsibility? If yes, in what ways? If not, why not? What is the role of the information and news media in the shaping of political opinions?
Implement a for loop in the application : Create a method in the class student that returns what the student is doing and this method have to generate the behavior randomly. It can't return the same thing every time.
Role of personality in affecting situational behavior : Write a 1.400- to 1,750-word paper in which you compare and contrast the theories selected. Address the following: Describe the role of personality in affecting situational behavior
Problem regarding the character development : Describe a key conflict in the play and how it corresponds to a character's development. Describe two key literary techniques and elements of drama that aid in developing the conflict.
Characteristics or christian schools : (300 word count) Prompt: There are some educators who do not like to label a school as "Christian" or not. As educators, can you work in a public school and lead a "Christian classroom"?
Question regarding the sound venture : Death of a Salesman- Would Happy and Biff be effective business owners and would their enterprise be a sound venture if you were looking to invest?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd