Professional Documents
Culture Documents
BSIT 1-A
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package itpacts;
import java.util.*;
/**
*
* @author user
*/
public class Module12 {
/**
* @param args the command line arguments
*/
public static void main(String[] args){
Scanner input = new Scanner(System.in);
//declaration
double x;
double total = 0;
double discount;
double dtotal;
//user input
for (int i = 10; i != 0; i--){
System.out.print("Please input price(" + i + "): ");
x = input.nextDouble();
total += x;
System.out.println("--------------------------");
System.out.println("Continue?");
System.out.println("0 or YES");
System.out.println("1 for NO");
System.out.print("Input here: ");
int _temp;
_temp = input.nextInt();
System.out.println("--------------------------");
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
System.out.printf("Total: " + " %.2f %n", total);
System.out.printf("Discount: "+"%.2f %n",discount);
System.out.printf("Amount Due: "+"%.2f %n", dtotal);
}
}
//Module 12 Activity (No. 2)
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package itpacts;
import java.util.*;
/**
*
* @author user
*/
public class Module12 {
/**
* @param args the command line arguments
*/
public static void main(String[] args){
//outputs table
System.out.println("-------------------------------------------------------");
System.out.println(" COURSE | AMOUNT PER UNIT | MISCELLANEOUS ");
System.out.println("-------------+---------------------+-------------------");
System.out.println(" BSCS | 890.50 | 6500.85 ");
System.out.println(" BSIT | 900.45 | 6800.89 ");
System.out.println(" BSCpe | 1010.89 | 7352.45 ");
System.out.println("-------------------------------------------------------");
} //end of main
String course;
int numOfUnits;
double misc = 0;
double dAmount;
double totalAmount = 0;
double amountPerUnit;
int payMode;
//inputs course and no. of units
System.out.print("Course: ");
course = input.next();
System.out.print("Number of Units: ");
numOfUnits = input.nextInt();
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;
}
// returns totalAmount
return totalAmount;
}
}