0% found this document useful (0 votes)
48 views7 pages

Week 12 Activity

The document is a Java program that calculates tuition fees and discounts. It takes user input for course details and payment mode then computes the total amount due. It uses methods, loops, and conditional statements.

Uploaded by

juencyzalty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views7 pages

Week 12 Activity

The document is a Java program that calculates tuition fees and discounts. It takes user input for course details and payment mode then computes the total amount due. It uses methods, loops, and conditional statements.

Uploaded by

juencyzalty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Dela Cruz, Franc Alvenn T.

BSIT 1-A

//Module 12 Activity (No.1)

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/[Link] to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/[Link] to edit this template
*/
package itpacts;
import [Link].*;
/**
*
* @author user
*/
public class Module12 {

/**
* @param args the command line arguments
*/
public static void main(String[] args){
Scanner input = new Scanner([Link]);
//declaration
double x;
double total = 0;
double discount;
double dtotal;

//user input
for (int i = 10; i != 0; i--){
[Link]("Please input price(" + i + "): ");
x = [Link]();
total += x;
[Link]("--------------------------");
[Link]("Continue?");
[Link]("0 or YES");
[Link]("1 for NO");
[Link]("Input here: ");
int _temp;
_temp = [Link]();
[Link]("--------------------------");
if(_temp == 1){
break;
}
}
//computes for discount if applicable
if(total > 5000 && total < 7000.50){
discount = (total/100)*10;
dtotal = total - discount;
}else if(total >= 7000.50){
discount = (total/100)*5;
dtotal = total - discount;
}else{
discount = 0;
dtotal = total - discount;
}
//prints total, discount, and amount due
[Link]("Total: " + " %.2f %n", total);
[Link]("Discount: "+"%.2f %n",discount);
[Link]("Amount Due: "+"%.2f %n", dtotal);
}
}
//Module 12 Activity (No. 2)

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/[Link] to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/[Link] to edit this template
*/
package itpacts;
import [Link].*;
/**
*
* @author user
*/
public class Module12 {

/**
* @param args the command line arguments
*/
public static void main(String[] args){

//outputs table
[Link]("-------------------------------------------------------");
[Link](" COURSE | AMOUNT PER UNIT | MISCELLANEOUS ");
[Link]("-------------+---------------------+-------------------");
[Link](" BSCS | 890.50 | 6500.85 ");
[Link](" BSIT | 900.45 | 6800.89 ");
[Link](" BSCpe | 1010.89 | 7352.45 ");
[Link]("-------------------------------------------------------");

//calls the method and prints the result


[Link]("Total Amount: " + method());

} //end of main

//method with return type double


public static double method(){
Scanner input = new Scanner([Link]);

String course;
int numOfUnits;

double misc = 0;
double dAmount;
double totalAmount = 0;
double amountPerUnit;
int payMode;
//inputs course and no. of units
[Link]("Course: ");
course = [Link]();
[Link]("Number of Units: ");
numOfUnits = [Link]();

switch(course){
case "BSCS", "bscs":
amountPerUnit = 890.50;
totalAmount = amountPerUnit * numOfUnits;
misc = 6500.85;
break;
case "BSIT","bsit":
amountPerUnit = 900.45;
totalAmount = amountPerUnit * numOfUnits;
misc = 6800.89;
break;
case "BSCpe","BSCPE","bscpe":
amountPerUnit = 1010.89;
totalAmount = amountPerUnit * numOfUnits;
misc = 7352.45;
break;
}

//asks for payment mode


[Link]("----------------------------------");
[Link]("Payment mode: ");
[Link]("0 for cash");
[Link]("1 for monthly");
[Link]("Input here: ");
payMode = [Link]();
[Link]("----------------------------------");

//checks if discount is applicable


if(payMode == 0){
dAmount = (totalAmount/100)*10;
totalAmount = (totalAmount - dAmount)+ misc;

}else if(payMode == 1){


dAmount = (totalAmount/100)*10;
totalAmount = (totalAmount + dAmount)+ misc;
}

// returns totalAmount
return totalAmount;
}
}

You might also like