hi guys, this is my 2nd time to post codes to ask ideas/suggestions from you.. ;)
this is my project at this time. i am having another simulation study regarding electric consumption of an internet shop. this is my simulation problem which i will trying to simulate.
* i will going to determine the electric consumption of each computer which the internet cafe have 15 computers.
i have my equation to compute the cost of electric consumption.
Watts x Hours Used
.............1000.................x Cost per kilowatt-hour = Total Cost
where: watt = random between 65-250 watts
hours Used = random between 5 - 900mins which 900 is equavalent to 15hrs because internet cafe operate only 15hrs a day.
cost per kwh = 3.92 (fixed)
MY PROBLEM now are:
1. How to loop the random values of watts and hours simultaneously of 15 computers?
sample table:
PC no. 1
__________________________
|Time used (hrs) | Watt Used |
__________________________
..........4................|........130 |
..........1................|........218 |
..........3................|........121 |
..........2................|........135 |
..........1................|........224 |
..........3................|........99 |
..........1................|........234 |
______________|___________|
sample equation:
PC1x1 = (((130 * 4) / 1000) * 3.92) = 2.03
PC1x2 = (((218 * 1) / 1000) * 3.92) = .85
PC1x3 = (((121 * 3) / 1000) * 3.92) = 1.42
2. How to codes summation in java? i attached my equation..:) I am having trouble of coding my algorithm on my equation..
3. How to filter the hours if it is exceed 15hrs?
here is my code initial code where i am having trouble of looping and filtering. that will be my
Code:import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.border.*;
import java.util.Random;
import java.util.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.text.*;
public class ICS
{
public static void main (String args[])
{
int tu;
double wattrate = 3.92;
for (int x=0; x<=5; x++){
Random tur = new Random();
int turmin = 5;
int turmax = 900;
tu = tur.nextInt (turmax-turmin+1)+ turmin;
double tt = tu / 60;
System.out.println("Time used: " + tt);
Random war = new Random();
int min = 65;
int max = 250;
int wa = war.nextInt(max-min+1)+min;
int wax = wa;
double totalwat = (wax * tt) / 1000;
double totalcost = totalwat * wattrate;
DecimalFormat ttcost = new DecimalFormat ("#.##");
System.out.println("Watt used by PC 1: " +wax);
System.out.println("Total KWh used:" + totalwat);
System.out.println("Total KWh cost: $" + ttcost.format(totalcost) + " in " + tt + "hour(s)" + "\n");
}
System.exit(0);
}
}
PS: for comments, questions, suggestion, please free to ask and post.. . learning is getting more ideas from other. listening suggestions for improving one self..:)

