You are on page 1of 5

Stephen Drexel Ibus

BSIT2

1. using System;
namespace Test {    
class ExchangeTest    
{         static void Main()    
    {          
 System.out.println("Enter amount in USD:");
string tmp =
Console.ReadLine();          
float dollars;          
  if(!float.TryParse(tmp, out dollars))          
  {            
    Console.WriteLine("Usd”:{0.00.00 x 0.00.00=”php”}");          
  }          
  else             
{  
Console.WriteLine("The value in pesos: {0:0.00}", dollars * 50.74);          
}

    }

    }
}
2. import java.util.Scanner;

public class Employee


{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter employee's name:");
String employee = input.next();
System.out.println("Enter number of hours worked:"); double hours =
input.nextDouble();
System.out.println("Enter hourly pay rate:"); double pay =
input.nextDouble();
double gross_pay = pay * hours;
System.out.println("The Gross pay of " + employee + " is " +
gross_pay);
}
}
3. import java.util.Scanner; public class Main
{ public static void main(String[] args) { Scanner input = new
Scanner(System.in); System.out.println("Enter the amount
deposited:"); double p = input.nextDouble();
System.out.println("Enter the time (in days):");
double time = input.nextDouble(); double t = time / 365;
System.out.println("Enter the interest(in percentage):");
double interest = input.nextDouble(); double r = interest /
100; System.out.println("Enter the ammount of withholding tax(in
percentage:"); double tax = input.nextDouble(); double
taxdecimal = tax / 100;
double i = (p*r*t); double withholding = taxdecimal * i;
double taxed = i - withholding;
System.out.println("Your withholding tax is: " + withholding);
System.out.println("Your interest with tax is: " + taxed);
System.out.println("The net interest you will receive is: " +
i );
}
}
4 import java.util.Scanner;
public class speed { public static void main(String args[])
{ int distance = 5400; int speed = 220;
double time = distance / speed;
System.out.println("Time in hours " + time);
}
}

You might also like