<< Chapter < Page Chapter >> Page >

Question 15

Write the program described in Listing 13.

Listing 13 . Question 15.
/*File Ap0010e1.java Copyright 2012, R.G.Baldwin Instructions to student:This program refuses to compile without errors. Make the necessary corrections to cause the program tocompile and run successfully to produce an output similar to that shown below. Note that the values should bedifferent each time the program is run.-1.30240579E8 -1.30240579E8**********************************************************/ //Student is not expected to understand import directives// at this point. import java.util.Random;import java.util.Date; public class Ap0010e1{public static void main(String args[]){//Create a random number for testing. Student is not // expected to understand how this works at this point.Random random = new Random(new Date().getTime()); double doubleVar = random.nextInt()/1.0;//Student should understand the following double var = doubleVar;System.out.println(doubleVar); new Worker().doIt(doubleVar);}//end main() }//end class definition//=======================================================// class Worker{public void doIt(double val){ int var = val;System.out.println(var); }//end doIt()}//end class definition //=======================================================//

Question 16

Write the program described in Listing 14 .

Listing 14 . Question 16.
/*File Ap0010f1.java Copyright 2012, R.G.Baldwin Instructions to student:Beginning with the code shown below, modify the code in the method named doIt so that the programdisplays 3.3333333333333335 instead of 3Then modify the method again so that the program displays 3.3333333 instead of 3**********************************************************/ public class Ap0010f1{public static void main(String args[]){new Worker().doIt(); }//end main()}//end class definition //=======================================================//class Worker{ public void doIt(){System.out.println(10/3); }//end doIt()}//end class definition //=======================================================//

Question 17

Write the program described in Listing 15 .

Listing 15 . Question 17.
/*File Ap0010g1.java Copyright 2012, R.G.Baldwin Instructions to student:Beginning with the code shown below, modify the code in the method named doIt so that the programdisplays 2048 instead of 2730Did you notice anything particularly interesting about the values involved?**********************************************************/ public class Ap0010g1{public static void main(String args[]){new Worker().doIt(16384); }//end main()}//end class definition //=======================================================//class Worker{ public void doIt(int val){System.out.println(val/6); }//end doIt()}//end class definition //=======================================================//

Question 18

Write the program described in Listing 16 .

Listing 16 . Question 18.
/*File Ap0010h1.java Copyright 2012, R.G.Baldwin Instructions to student:This program refuses to compile without errors. Make the necessary corrections to cause the program tocompile and run successfully to produce the output shown below:false **********************************************************/public class Ap0010h1{ public static void main(String args[]){ new Worker().doIt();}//end main() }//end class definition//=======================================================// class Worker{public void doIt(){ boolean var;System.out.println(var); }//end doIt()}//end class definition //=======================================================//

Questions & Answers

summarize halerambos & holbon
David Reply
the Three stages of Auguste Comte
Clementina Reply
what are agents of socialization
Antonio Reply
sociology of education
Nuhu Reply
definition of sociology of education
Nuhu
what is culture
Abdulrahim Reply
shared beliefs, values, and practices
AI-Robot
What are the two type of scientific method
ogunniran Reply
I'm willing to join you
Aceng Reply
what are the scientific method of sociology
Man
what is socialization
ogunniran Reply
the process wherein people come to understand societal norms and expectations, to accept society's beliefs, and to be aware of societal values
AI-Robot
scientific method in doing research
ogunniran
defimition of sickness in afica
Anita
Cosmology
ogunniran
Hmmm
ogunniran
list and explain the terms that found in society
REMMY Reply
list and explain the terms that found in society
Mukhtar
what are the agents of socialization
Antonio
Family Peer group Institution
Abdulwajud
I mean the definition
Antonio
ways of perceived deviance indifferent society
Naomi Reply
reasons of joining groups
SAM
to bring development to the nation at large
Hyellafiya
entails of consultative and consensus building from others
Gadama
World first Sociologist?
Abu
What is evolutionary model
Muhammad Reply
Evolution models refer to mathematical and computational representations of the processes involved in biological evolution. These models aim to simulate and understand how species change over time through mechanisms such as natural selection, genetic drift, and mutation. Evolutionary models can be u
faruk
what are the modern trends in religious behaviours
Selekeye Reply
what are social norms
Daniel Reply
shared standards of acceptable behavior by the group or appropriate behavior in a particular institution or those behaviors that are acceptable in a society
Lucius
that is how i understood it
Lucius
examples of societal norms
Diamond
Discuss the characteristics of the research located within positivist and the interpretivist paradigm
Tariro Reply
what is Industrialisation
Selekeye Reply
industrialization
Angelo
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask