Answer to Question #311457 in Java | JSP | JSF for aqilah

Question #311457

Write a class that contains variables to hold your tuition fee and your book fee. Display the sum of the variables. Save the class as Fees.java. 



1
Expert's answer
2022-03-14T13:04:50-0400
public class Fees {
    private double tuitionFee;
    private double bookFee;

    public Fees(double tuitionFee, double bookFee) {
        this.tuitionFee = tuitionFee;
        this.bookFee = bookFee;
    }

    public double sumOfFees(){
        return tuitionFee + bookFee;
    }
}


public static void main(String[] args) {
    System.out.println(new Fees(34.6, 32.8).sumOfFees());
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS