Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CS240
BACHELOR OF INFORMATION TECHNOLOGY (HONS)
LAB ASSIGNMENT 1
SOURCE CODE
import java.util.*;
public class Score {
do
{
respondent += 1 ;
System.out.print("Score for respondent " +respondent +" : ");
int num = input1.nextInt();
response = num;
{
System.out.println ("Score\t" +"Total Number Of Respondent");
System.out.println ("-----------------------------------");
System.out.println ("1\t\t\t\t\t" +score1);
System.out.println ("2\t\t\t\t\t" +score2);
System.out.println ("3\t\t\t\t\t" +score3);
System.out.println ("4\t\t\t\t\t" +score4);
System.out.println ("5\t\t\t\t\t" +score5);
int total = score1 + score2 + score3 + score4 + score5;
int average = ((score1 * 1)+(score2 * 2)+(score3 * 3)+(score4 *
4)+(score5 * 5))/ total;
System.out.println ();
System.out.println ("Total overall respondent: " +total);
System.out.println ("Average score result: " +average);
}
}
}
SAMPLE INPUT
SAMPLE OUTPUT
QUESTION 1.2
SOURCE CODE
import java.util.*;
import java.text.*;
public class Bill {
do
{
System.out.print("Enter your Name: ");
String name = input1.nextLine();
System.out.print("Enter your Address: ");
String address = input1.nextLine();
if ( category == 1)
{
if (units > 1 && units <= 100)
total = units * 0.1;
else if ( units <= 300)
total = (units - 100)* 0.17 + 10;
else
total = (units - 300)*0.2 + 10 + 34;
totalcust1 += 1;
bill = total + HomeRent;
totalCollection1 += bill;
}
else if ( category == 2)
{
if (units > 1 && units <= 200)
total = units * 0.3;
else if ( units <= 600)
total = (units - 200)* 0.27 + 60;
else
total = (units - 600)* 0.2 + 60 + 108 ;
totalcust2 += 1;
bill = total + CommercialRent;
totalCollection2 += bill;
totalcust3 += 1;
bill = total + IndustrialRent;
totalCollection3 += bill;
Feedback =
response.toUpperCase().charAt(0);
System.out.println("\n");
SAMPLE OUTPUT