0% found this document useful (0 votes)
11 views2 pages

Import Java

The document contains two Java programs. The first program calculates the total cost of two items, including quantities, unit prices, subtotal, government tax, service charge, and total amount. The second program appears to be set up for inputting student assessment scores but is incomplete.

Uploaded by

okuwobi
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)
11 views2 pages

Import Java

The document contains two Java programs. The first program calculates the total cost of two items, including quantities, unit prices, subtotal, government tax, service charge, and total amount. The second program appears to be set up for inputting student assessment scores but is incomplete.

Uploaded by

okuwobi
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

import java.util.

Scanner;

public class lab3q1 {

public static void main(String[] args) {


// TODO Auto-generated method stub

Scanner scanner=new Scanner(System.in);


System.out.print("Item 1:");
String item1=scanner.nextLine();
System.out.print("Quantity:");
int quantity=scanner.nextInt();
System.out.print("Unit Price:");
double unitPrice=scanner.nextDouble();

double Amount=quantity*unitPrice;

Scanner sc=new Scanner(System.in);

System.out.print("Item 2:");
String item2=sc.nextLine();
System.out.print("Quantity :");
int quantity2=sc.nextInt();
System.out.print("Unit Price:");
double unitPrice2=sc.nextDouble();

double Amount2=quantity2*unitPrice2;

double subtotal=Amount+Amount2;
double governmentTax=subtotal*0.06;
double serviceCharge=subtotal*0.08;
double total=subtotal+governmentTax+serviceCharge;

System.out.println("Item 1:"+item1);
System.out.println("Quantity:"+quantity);
System.out.println("Unit Price:"+unitPrice);
System.out.println("Amount:"+Amount);
System.out.println("--------------------");
System.out.println("Item 2:"+item2);
System.out.println("Quantity :"+quantity2);
System.out.println("Unit Price:"+unitPrice2);
System.out.println("Amount:"+Amount2);
System.out.println("");
System.out.println("Subtotal:"+subtotal);
System.out.println("Government tax (6%):"+governmentTax);
System.out.println("Service charge (8%):"+serviceCharge);
System.out.println("Total:"+total);

import java.util.Scanner;

public class lab3q2 {

public static void main(String[] args) {


// TODO Auto-generated method stub

Scanner scanner=new Scanner(System.in);


//System.out.print("Matric:");
int matric=scanner.nextInt();
//System.out.print("Enter 1st Test:");
double firstTest=scanner.nextDouble();
//System.out.print("Enter 2nd Test:");
double secondTest=scanner.nextDouble();
//System.out.print("Enter Assignment 1:");
double assignment1=scanner.nextDouble();
//System.out.print("Enter Assignment 2:");
double assignment2=scanner.nextDouble();
//System.out.print("Enter Assignment 3:");
double assignment3=scanner.nextDouble();
//System.out.print("Enter your Final Exam mark:");
double finalExam=scanner.nextDouble();

You might also like