4 Replies - 1995 Views - Last Post: 30 December 2005 - 06:42 AM Rate Topic: -----

#1 stillkeepinitreal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-December 05

Billing Utility

Posted 27 December 2005 - 02:26 PM

I am having serious problems with some uni project . It basically involves the use of java to build a gas and electricity billing system. Since i have never really used java, i am finding it hard to do this project. If anyone has got a clue about what to do, please get incontact with me. Any help would be very much appreciated. The link for the project is
http://www.soc.staff...-assignment.doc

Cheers.

Is This A Good Question/Topic? 0
  • +

Replies To: Billing Utility

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Billing Utility

Posted 27 December 2005 - 07:47 PM

We'd be more than willing to provide some guidance for your assignment, but we prefer to see that you have at least attempted it yourself before beginning. Please post the code you've written, and we can assess it from there.
Was This Post Helpful? 0
  • +
  • -

#3 stillkeepinitreal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-December 05

Re: Billing Utility

Posted 29 December 2005 - 09:48 AM

Ok thats fine. So far, the only code i have been able to generate and it works is...
public class GasBill01
{
public static void main(String[] args)
{
String accNum;
System.out.println("Enter your account number: ");
accNum = SimpleInput.readString();
int numUnits;
System.out.println("Enter the number of units used: ");
numUnits = SimpleInput.readInt();
double costPerUnit = 1.5;
double totalCost;
totalCost = (numUnits * costPerUnit) + 25.77;

System.out.println("Customer account number: " + accNum);
System.out.println("Units of gas used: "+ numUnits);
System.out.println("Total cost: £" + totalCost + "\n");
}
}
but this will ony giv me a pass grade. I wanna get a high merit and preferable a distinction. I cant manage a variable number of account, and basically some bits that would get me a good merit.
Please any help would be fine.
Cheers :-)
Was This Post Helpful? 0
  • +
  • -

#4 bluesuus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 65
  • Joined: 26-December 05

Re: Billing Utility

Posted 29 December 2005 - 12:05 PM

HEY, i m skimming throug the assignment..i believe your instructor is asking a lot more than just the program.He wants you to design in it in object oriented view.that is put everything in somewhat like a class.here is an idea.
create an abstract class caled OctagonUtilties.

public abstract class OctagonUtilites extends Object {
private String name;
private String address;
private int refNum;

public OctagonUtilities( String n, add, int ref) 
{
name = n;
address = add;
refNum = refNum;

//here put code to print variables name,address and refNum
}

public void setName( String n )
{
name = n;
}
public String getName()
{
return name;
}
public void setAddress( String add )
{
address = add;
}
public String getAddress()
{
return address;
}
public void setRef( int ref )
{
refNum = ref;
}
public String getRef()
{
return refNum;
}


public double  calAmount()// retur 0.0 by default for all calculatins

{
return 0.0;
}

 }


Ok what i have done here is created an abstract class( no objects of this class is to instantiated).class Elictricity and Gas would extend OctagonUtilities class.



 public class Gas extends OctagonUtilites {
private prevmeterReading;
private currmeterReading;

public Gas(String n, String add, int ref) 
{
 super( n, add, ref );
prevmeterReading = 0;
currmeterReading = 0;

}

public void setprevMeterReading( int m )
{
prevmeterReading = m;
}

public void getprevMeterReading()
{
return prevmeterReading;
}
public void setcurrMeterReading( int m )
{
currmeterReading = m;
}

public void getpcurrMeterReading()
{
return currmeterReading;
}


public double calAmount( ) // overiding abstract method calAmount
{
return  (currmeterRerading - prevmeterReading) * 1.5;
}



This code is still incomplete you have to make a lot of corrections..but im givn you an idea of how i think your innstructor wants it in object oriented.Amadeus what do u think.
Was This Post Helpful? 0
  • +
  • -

#5 stillkeepinitreal  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-December 05

Re: Billing Utility

Posted 30 December 2005 - 06:42 AM

Thank you very much for your help so far bluesuus. If any body has got any more help to offer, please do not hesistate. I am absolutely awful at java, but it is sumtin i got to do to pass da year.

Cheers People.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1