University of Uyo ( Uniuyo Java Project); Laboratory work 1

UNIUYO Java Project 1

  1. Create a new project with a name LabWork_1
  2. Change the class name to Project_1
  3. Write the codes to print the size of primitive datatypes in java on the console

Solution (1 and 2)

  1. Open NetBeans IDE.
  2. Go to the “File” menu and select “New Project…”
  3. In the “New Project” dialog, choose the “Java” category and “Java Application” project type, then click “Next”.
  4. Enter “LabWork_1” as the Project Name, choose the project location, and click “Finish”.
  5. In the Projects window, expand the “LabWork_1” project folder, then expand the “Source Packages” folder.
  6. Right-click on “LabWork_1” and select “property” from the dialog box; rename it “Project_1”

Solution (3)

Output

java project 1

UNIUYO Java Project 2

  1. Within the LabWork_1 project, create a new java class Project_2. Note, the new java class may not have a main method. you are to include the main method
  2. Declare any six variables as integer, String, floating-point, character, Boolean and double respectively.
  3. Assign Arbitrary value to them, and print them using printf() function.

Solution

Uniuyo java project project 2

Output

uniuyo java project 2

UNIUYO Java Project 3

  1. Create a new java class Project_3, type and run the code segment below

public class Project_3

{

double side_a =20;

double side_b =27.45;

int side_c = 10;

public static main(String[] args)

{

double s=(side_a + side_b + side_c)/2;

duble ScaleneArea =Math.sqrt(s*(s-side_a)*(s-side_b)*(s-side_c));

System.out.printf(“%.3d is the area of the scalene triangle\n”, ScaleneArea);”

}

}

2. Briefly state your observation

3. Debug the program to run without error, then copy your code and the output in the box below

Solution

Observation

  1. Missing access specifier for the main method. It should be public static void main(String[] args).
  2. The variables side_a, side_b, and side_c are declared outside of main method, but they are being accessed from the main method, which is a static method. To access these variables from a static method, they should also be declared as static. Or they should be declared inside the main method.
  3. The printf statement has incorrect formatting for the output. It should be “%.3f is the area of the scalene triangle\n”.

Both of the codes above will work; either you declare the variables as static or you declare them inside the main method.

Output

project 3 output

UNIUYO Java Project 4

  1. Write a java program to prompt a user to type in his/her student’s registration number, name, year of birth, department, test score and exam score
  2. Display the registration number, name, age, department, and total score in a tabular form.

Solution

UNIUYO Java Project 5

Write a java code to implement the following models; hence determine the value of model_1, model_2, model_3 and model_4.

question 5

Solution

Model_1 return NaN as output because the negative value of v makes the value inside the square root negative, which is an imaginary number. the code below takes care of it.

Output

Project 5

The Java solutions provided in this practical manual are intended solely as a study guide to aid students in understanding the concepts and techniques of Java programming. These solutions are not meant to be copied or reproduced verbatim in any form, including but not limited to test papers, quizzes, examinations, or any other academic assessments.

Copying or reproducing these solutions in the test hall or any other academic setting is a violation of academic integrity and ethics. Such actions may result in serious consequences, including but not limited to academic penalties, disciplinary action, or other sanctions imposed by educational institutions.

Students are encouraged to use these solutions as a reference to enhance their learning experience, clarify doubts, and reinforce their understanding of Java programming principles. It is essential to engage actively with the material, practice coding independently, and develop problem-solving skills to succeed in Java programming courses.

Furthermore, we disclaim any liability for the misuse or inappropriate use of these solutions. Users are solely responsible for their actions and adherence to academic integrity policies and guidelines.

Read on different scholarship opportunity on webzalo scholarship

Related Posts

$100k Australia Visa Sponsorship Opportunities for Immigrants

Australia is one of the most sought-after destinations for skilled workers worldwide. With a growing economy, a high demand for professionals in various industries, and generous visa sponsorship programs, it…

Read more

$100k UK Visa Sponsorship Opportunities for Immigrants

In 2024/2025, the UK offers lucrative visa sponsorship opportunities for immigrants across multiple industries, with salaries reaching up to $100k annually. These opportunities are driving global professionals to the UK…

Read more

Factory Workers Jobs in Australia with Free Visa Sponsorship

Australia has become a top destination for immigrants worldwide due to its booming economy, stable political environment, and welcoming attitude toward foreign workers. One of the most accessible employment opportunities…

Read more

Highest Paying Jobs For Foreigners in Canada with Visa Sponsorship

Canada is widely recognized as a leading destination for immigrants pursuing high-paying careers and an exceptional quality of life. With welcoming immigration policies and a strong, diverse job market, the…

Read more

Unicef Job Recruitment 2024

Are you passionate about making a difference in the lives of children and communities worldwide? The Unicef Job Recruitment process offers opportunities for individuals to contribute to global development, health,…

Read more

$15,000 Construction Jobs in the UK with Visa Sponsorship

Explore $15,000 construction jobs in the UK with visa sponsorship and learn about salaries, opportunities, success stories, and how to land your dream job today. Just think about being able…

Read more