my method studentisdoing(); generates 20 random things student doing @ given time using statement. need making summary of output generated method , percentage each output generates each time (the numbers below example, percentagess vary):
kissing girlfriend 40% of time swimming 30% of time surfing 30% of time etc...
import java.util.random;
public class app
{
public static void main(string[] args)
{
student st = new student();
st.studentisdoing();
}
}
here example of code reads student class: changes everytime;
ross gerard is: kissing girlfriend
ross gerard is: swimming
ross gerard is: eating snack
ross gerard is: swimming
ross gerard is: taking shower
ross gerard is: studying java
ross gerard is: eating snack
ross gerard is: dancing
ross gerard is: reading paper
ross gerard is: kissing girlfriend
ross gerard is: drinking coffee
ross gerard is: playing dogs
ross gerard is: reading paper
ross gerard is: playing ball
ross gerard is: taking shower
ross gerard is: reading paper
ross gerard is: taking shower
ross gerard is: primping in mirror
ross gerard is: doing jiu-jitsu
ross gerard is: reading paper
you need count number of times each activity observed in output. can keep track of these in array. each time see activity #x
, increment value @ position x
in array. @ end, sum total number of observations in array. percentage numberoftimesxoccurred/totalnumberofobservations
.
Comments
Post a Comment