Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Calculate method problem.....

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Calculate method problem.....

    public class BillTest
    {
    public static void main (String[]arg)
    {
    Bill mum=new Bill(130,100);
    Bill sister=new Bill(200,50);
    Bill family=new Bill(0,0);
    family=family.calculateTotal(mum,sister);
    System.out.println("Total bill:");
    family.calculateBill();
    }
    }
    public class Bill
    {
    int airtime;
    int totalSms;
    int total;
    public double callrate=0.25;
    public double smsrate=0.05;


    Bill(int a, int s)
    {
    airtime = a;
    totalSms= s;
    }
    public double calculateBill()
    {
    return (airtime * callrate+ totalSms * smsrate);
    }

    public double calculateTotal(int m, int s)
    {
    double total= m + s;
    return(total);
    }



    }
    What calculate method can be use to calculate of 2 object mum&sister in family object....
    confusing... Some buddy help me?


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Calculate method problem.....

    Why are you posting a duplicate post when you already have an active thread in the forum for this problem? By splitting the discussion all you will likely do is frustrate those who have tried to help you, and I don't think that this is your goal nor is it a worthy goal.

Similar Threads

  1. Method calculate 2 object using constructor with parameter
    By DavidXCode in forum Object Oriented Programming
    Replies: 2
    Last Post: November 21st, 2012, 09:31 PM
  2. Looping method problem.
    By Swen in forum What's Wrong With My Code?
    Replies: 24
    Last Post: December 29th, 2011, 09:49 AM
  3. Replies: 3
    Last Post: October 26th, 2011, 03:37 PM
  4. Cannot calculate. Please help me....
    By safarina02 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 15th, 2011, 01:11 PM
  5. problem with Scanner nextLine() method
    By mia_tech in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: March 10th, 2009, 04:14 AM