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

  Simulate distributing furniture from wholesale to stores

A Wholesale furniture distributing company in Florida is providing furniture to 4 furniture stores. Write an application to simulate distributing furniture from Whole sale center to different stores.

  Prepare executable program and a dictionary program

Prepare executable program and a dictionary Program.

  How threads are used to implement currency in java

Describe the concept of concurrency and how threads are used to implement currency in Java

  Explain the graphical coordinate system in java where is

question 1 describe the graphical coordinate system in java. where is the origin? what units apply to the xy

  Constructing a simple flowchart that describes simple logic

Constructing a simple flowchart that describes simple logic flow through a program. Translating the flowchart into pseudo code. Creating a simple module, based on the pseudo code created in step 2, which accepts a parameter and returns a value.

  Demonstrate your knowledge in a pragmatic way

Summarize everything that we have addressed in the XML Applications course, and provide a mechanism to demonstrate your knowledge in a pragmatic way.

  Personalize the time zone application of section 24.3

Personalize the time zone application of Section 24.3. Prompt the user to log in and specify a city to be stored in a profile. The next time the user logs in, the time of their favorite city is displayed automatically.

  Create simple java program that determine cost of insurance

Need to create a simple Java program that determines cost of insurance by including any additional person based on age (thus questions regarding age and how many people apply to each category as far as age should be included)

  Write a method called sigma

Write a method called sigma that takes an int parameter n and returns the sum of all the integers from 1 to n (inclusive). For example, sigma(4) should return 10.

  Create a java class called student

Create a Java class called student with the following instance variables: private String studentName

  Develop a data type for the time of day

Time. Develop a data type for the time of day. Provide client methods that return the current hour, minute, and second, as well as to String() and compare To() methods. Develop two implementations: one that keeps the time as a single int value (nu..

  Write a thread function to initialize 2d array

write a thread function to initialize int 2D array x (NxN) so that each thread initializes its portion with i+j in each slot. Note that i and j relate to the entire array.

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