This page is optimized for mobile devices, if you would prefer the desktop version just
click here
Question 21
Write the program described in Listing 21 .
Listing 21 . Listing for Question 21. |
---|
/*File Ap0020f1.java Copyright 2012, R.G.Baldwin
Instructions to student:Beginning with the code fragment shown below, write a
method named doIt that:1. Illustrates the effect of the modulus operation with
doubles.**********************************************************/
public class Ap0020f1{public static void main(String args[]){new Worker().doIt();
}//end main()}//end class definition
//=======================================================//class Worker{
//-----------------------------------------------------////Student: insert the method named doIt between these
// lines.//-----------------------------------------------------//
}//end class definition//=======================================================// |
Question 22
Write the program described in Listing 22 .
Listing 22 . Listing for Question 22. |
---|
/*File Ap0020g1.java Copyright 2012, R.G.Baldwin
Instructions to student:Beginning with the code fragment shown below, write a
method named doIt that:1. Illustrates the concatenation of the following strings
separated by space characters."This"
"is""fun"
Cause your program to produce the following output:This
isfun
This is fun**********************************************************/
public class Ap0020g1{public static void main(String args[]){new Worker().doIt();
}//end main()}//end class definition
//=======================================================//class Worker{
//-----------------------------------------------------////Student: insert the method named doIt between these
// lines.//-----------------------------------------------------//
}//end class definition//=======================================================// |
Listings
I recommend that you open another copy of this document in a separate browser window and use the following links to easilyfind and view the listings while you are reading about them.
- Listing 1 . Listing for Question 1.
- Listing 2 . Listing for Question 2.
- Listing 3 . Listing for Question 3.
- Listing 4 . Listing for Question 4.
- Listing 5 . Listing for Question 5.
- Listing 6 . Listing for Question 6.
- Listing 7 . Listing for Question 7.
- Listing 8 . Listing for Question 8.
- Listing 9 . Listing for Question 9.
- Listing 10 . Listing for Question 10.
- Listing 11 . Listing for Question 11.
- Listing 12 . Listing for Question 12.
- Listing 13 . Listing for Question 13.
- Listing 14 . Listing for Question 14.
- Listing 15 . Listing for Question 15.
- Listing 16 . Listing for Question 16.
- Listing 17 . Listing for Question 17.
- Listing 18 . Listing for Question 18.
- Listing 19 . Listing for Question 19.
- Listing 20 . Listing for Question 20.
- Listing 21 . Listing for Question 21.
- Listing 22 . Listing for Question 22.
Miscellaneous
This section contains a variety of miscellaneous information.
Housekeeping material
- Module name: Ap0020: Self-assessment, Assignment and Arithmetic Operators
- File: Ap0020.htm
- Originally published: January 7, 2002
- Published at cnx.org: 12/01/12
- Revised: 12/03/14
Read also:
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.