Home Discussion Discuss: Finding a Factorial using while loop

• ### finding HCF using do-while loopdudin21 September 2, 2011 at 8:54 AM

What is the code in finding the highest common factor of two integer?

• ### web programingSandy Togonon October 25, 2011 at 5:39 AM

share ur knowledges.

• ### java programmingkannan June 13, 2012 at 7:48 AM

You are required to write an application called Customer Billing System. This system will calculate water usage charges for a month that has been imposed by Syarikat Air Melaka Berhad. This system will categorise users into residential users and industrial users and calculate the charges based on data entered by the user. Data needed are the type of customer (Residential or Industrial), past meter reading and current meter reading. Given the charge rate as follows: For Residential: 0 â?? 15 m3 : RM 0.82 every m3 15.1 â?? 40 m3 : RM 0.65 every m3 40.1 m3 and above : RM 0.42 every m3 Minimum charge is RM 5.00 For Industrial: 0 m3 and above : RM 1.47 every m3 Minimum charge is RM15.00 Instruction: The above application must be able to hold information for up to 5 customers. Use an array and repetition structure to store information about users such as type of customer, past meter reading, current meter reading and charges. Write a structured Java program to develop the above system by following the steps below: a) Prompt the user to input the type of customer, past meter reading and current meter reading. Next, get the difference between current meter reading and past meter reading. b) Separate them as either R/r for Residential or I/i for Industrial. You can use any one of the two selection structures. c) Calculate the charges based on rates given above. If there is no water consumption, the minimum charge will be imposed. You can use any one of the two selection structures. d) Display information about the type of customer, past meter reading, current meter reading and charges for each customer. Print the information in table format.

Subject (*):

Related Articles
JSP Tutorials

Finding a Factorial using while loop
Finding a Factorial using while loop   ... are going to find out the factorial of 12 by using the while loop. In while loop...;TITLE>Finding a Factorial using while loop</TITLE> </HEAD>

JSP Tutorials

Finding a Factorial using while loop
Finding a Factorial using while loop     ... to calculate the factorial .Now use while loop and pass the condition that until... using while loop</font><br> <% int value = 12, factorial

Java Beginners

find the factorial
find the factorial  how to find the factorial through the while loop...) { int value = 5, factorial = 1, temp = value; while (temp > 0) { factorial *= temp; temp

PHP Questions

php array loop while
php array loop while  Using the php array while loop

Java Beginners

While loop Statement.
While loop Statement.   How to Print Table In java using While Loop

PHP Questions

php while loop
php while loop  Example to fetch the data using while loop in PHP

Java Beginners

java code using while loop
java code using while loop

Quartz Tutorials

Using while loop to loop through a cursor
Using while loop to loop through a cursor  ... while loop to loop through a cursor'. The Example create a table Stu_Table... that establish the result set. The While loop check a condition

Java Beginners

While loop Statement
While loop Statement  How to print a table using while loop?   The given example displays the multiplication table of the given number... +" = "); while(y<=10) { int t = x

Java Beginners

While loop - Java Beginners
While loop  Given a number, write a program using while loop to reverse the digits of the number. Eg. the no. is 12345, should be written as 54321...(br.readLine()); int n=num; int rem=0; int rev=0; while(n!=0

Java Beginners

loop
to output the following code using a loop the code is as follows with the user...(); System.out.print("Quantity: "); int quantity=input.nextInt(); while...("Quantity: "); int quantity=input.nextInt(); while(!code.equals("XX

Java-Tutorials

While Loop Statement in java 7
; System.out.println("While loop example"); // Using while loop while (i <= 10...While Loop Statement in java 7 This tutorial, helps you to understand the concept of while loop  in java 7. While Loop Statements : While loop

PHP Questions

For Loop/PHP
or do/while loop?   PHP Factorial Example: <?php \$n = 5; \$i = 1; \$f...For Loop/PHP  Write a class called math. It is to have one property called num. It also has one method called factorial. This method is to start

Java Beginners

factorial using recursive
factorial using recursive  can please give this code !i am going to do a factorial function using recursion definition and then . my professor told me that we are going to create a three screen. the first screen should be input

PHP Tutorial

PHP Loop Function
;<br/>"; echo "<b>Using While loop print 11 - 20<...;br/>"; \$a++; } echo "<b>Using Do-While loop... For-loop print 1 - 10 1 2 3 4 5 6 7 8 9 10 Using While loop print 11

Java Tips and Examples

Write a program to find a factorial in any given number
in scanner class object and using for loop, iterating  the loop from 1 to 5(i<...Write a program to find a factorial in any given number This programming tutorial will teach you how to write a factorial of any given number

Java Tips and Examples

Do-while loop in Java
: Example : Using this example you will understand the do-while loop easily.  ...Do-while loop in Java In this section you will learn about do-while loop in Java. do-while loop is similar to while loop but the difference is do-while loop

JSP Servlet Questions

How to delete the row from the Database by using while loop in servlet
How to delete the row from the Database by using while loop in servlet ... details. While loop is not terminate, in while loop why If condition... mistake and in while loop why if loop not working. please give me solution

Java Tips and Examples

'for' Loop
. The loop isn't executed if the boolean expression is false (the same as the while... of squares Here is a loop written as both a while loop and a for loop. First using while: int number = 1; while (number <= 12

JSP Tutorials

Use while loop in jsp code
; <H1>Using the while Loop</H1> <% out.println("Loop... Use while loop in jsp code       While loop is a control flow statement that works

PHP Tutorial

PHP While Loop
While Loop in PHP: In programming language we need to use loops for executing... Loop in PHP: While loop checks the condition first and if it is true... the condition to stop, and become infinite loop. While loop is also known as pre-test

JavaScript Questions

How to write a loop and a while loop
How to write a loop and a while loop  How do I write a 1 loop and a 1 while loop for the example code: public boolean isTheFirstOneBigger (int num1, int num2) { if (num1 > num2) { return true

PHP Questions

php do while loop
php do while loop  Difference between do while loop and simple loop in PHP

Java Code Examples

Java number calculation using while loop
Java number calculation using while loop In this tutorial, you will learn how to use while loop to solve certain number calculations. Here is an example...{ System.out.println("Odd Numbers: "); while(num1 <= num2) { if(num1%2 != 0

Java Beginners

Calculate factorial of a number.
Integer.parseInt(). For loop from 1 to num-1 calculating the factorial value of num...Calculate factorial of a number.  How to calculate factorial...; import java.io.InputStreamReader; public class Factorial { public static

Java Beginners

loop
loop  what is the difference b/w do while,while and for loop..with example

HTML Questions

Memory leak in While loop
Memory leak in While loop  How to manage a memory leak in While loop ?   make sure loop is not running infinitley...;make sure loop is not running infinitley

Java Beginners

do-while loop
do-while loop  how many times will the following loop get executed and what will be the final value of the variable I after execution the loop is over. int I = 5; do{ I + = 3; System.out.println(""+I); I=I+1; }while(I>=9

General

Iterator Java While
The Java While loop Iterator is the top tested loop. It is in two forms while(), do while() While loop is mostly used with Iterator compared to for loop Java While Loop Iterator Example import java.util.ArrayList; import

PHP Tutorial

while & do..while Loop
while & do..while Loop while loop The while loop iterate until provided condition is true. Given below the syntax : while (condition)  ...; <?php \$j=1; while(\$j<=3) { echo "Value of j" . \$j . "<

Tutorial Topics
Questions by Category