KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   J2EE  HTML  JAVA   Swing   Webtip  Forums  Lyric  Free sheet music  Ringtones

dish, directive installerI treat arithmetic operations in the following order:

  1. Multiplication (*) and division (/)
  2. Remainder (%)
  3. Addition (+) and subtraction (-)

For example: 2*3+5=11

But if you want to calculate 3+5 first then multiply 2? What should you do?

Using grouping operators - parentheses ()

It is like 2*(3+5)=16.

But remember , inside parentheses () I still follow the above order.

For example: 2*(3*2+4)=20, 2*(3*(2+4))=36.

Let us pretend you are a satellite dish installer, working for Directv or dish network. You have 118 receivers in hands. There are 30 houses applying to install dish in town. 20 house have 3 bedrooms. 10 houses have 4 bedroom. Each bedroom needs one receiver. You want me to calculate how many receivers are left after you installed all 30 houses.

OkieDokie Sir. As before, I will type code, compile and run.

class dishInstaller
public static void main(String[] args)
int NumberOf_3_Bedroom_House=20;
int NumberOf_4_Bedroom_House=10;
int TotalReceivers=100;
int NumberOfLeftReceiver=100%(20*3+10+4);
System.out.println("Number of left dish receivers="+NumberOfLeftReceiver);

Save it as Compile: javac Then run it : java dishInstaller. I get : Number of left dish receivers=16.


Correct? OK. You are qualified for DirecTV or dish network now. Go there and apply for a job.

Let's continue with that satellite dish installer project. This time suppose you have 126 receivers. After you installed all those houses? How many receivers left?

If DirecTV ask you to install more 4-bedroom houses by using the left receivers, how many more houses you could install?

if dish network ask you to install 3-bedroom houses by using the left receivers,

how many more houses you could install?

(Solution is here)


Try & Catch Exceptions
How to install JDK
Homework Solutions
JAVA JComboBox
JAVA JTabbedPane
Java JList
Best JAVA books
Head First JAVA, Second Editon

Effective Java Programming Language Guide

Professional Java, JDK 5 Edition

Ivor Horton's Beginning Java 2, JDK 5 Edition




Best books about JAVA programming from Amazon
Professional Java, JDK 5 Edition (Paperback Simply Java Programming: An Application-Driven Tutorial Approach (Paperback) Effective Java Programming Language Guide (Paperback) Head First Java, 2nd Edition (Paperback) Java : An Introduction to Problem Solving and Programming (4th Edition)


Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © All rights reserved(new). Privacy|Copyright
designed by

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer