


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



At the end of this lab, the students are able to: i. use identifiers to name variables, constants, methods and classes ii. use operators and expressions in the program
Writing pseudocode and Java program by exploiting the use of variables and integer data type.
You are required to write a Java program that asks the user to enter two integers, obtains them from the user and prints the square of each, the sum of their squares and the difference of the squares (first number squared minus the second number squared). In order to solve the problem, you need to do the following tasks: i. Design the algorithm in pseudocode. ii. Write a Java application using Scanner class. [Estimated Time: 30 minutes]
4.2 Activity
Writing pseudocode and Java program by exploiting the use of variables and constants.
Writea programthat inputs from the user the radius of a circle as a String and prints the circle's diameter, circumference and area using the floating-point value. The formulas to calculate the diameter, circumference and area of a circle are given below. The value for ฯ is 3.14159. ๐๐๐๐๐๐ก๐๐ = 2 ๐ ๐๐๐๐๐ข๐๐๐๐๐๐๐๐ = 2 ๐๐ ๐๐๐๐ = ๐๐^2 i. Design the algorithm in pseudocode. ii. Write a Java application using JOptionPane class. [Estimated Time: 30 minutes] 4.3 Activity 3
Writing pseudocode and Java program by exploiting the use of variables and class String.
Write a Java program that receives identity card (IC) number as a twelve digits string from the user. Then, the program should be able to identify birth date in the formatDD-MM-YYYY by extracting the first six first digits of the IC number. The program also able to calculate the current age based in the birth date extracted. To solve the problem, you are required to: i. Design the algorithm in pseudocode. ii. Write a Java application using JOptionPane class. [Estimated Time: 30 minutes]
4 .6 Activity 6
Writing pseudocode and Java program by exploiting the use of variables and constants.
Develop a Java program to calculate means, variance and standard deviation of the following statistical parameters of three values x 1 , x 2 , x 3. The program should be able toread these values from the keyboard and print the results. a) Mean: ๐ = ๐ฅ 1 +๐ฅ 2 +๐ฅ 3 3 b) Variance: ๐^2 = (๐ฅ 1 โ๐)^2 +(๐ฅ 2 โ๐)^2 +(๐ฅ 3 โ๐)^2 3 c) Standard deviation: ๐ = โ๐^2 You are required to: i. Design the algorithm in pseudocode. ii. Write a Java application using Scanner class. [Estimated Time: 50 minutes]