Question: Lab1: Q1: Java program to solve quadratic equations (use if, else if and else) Input Data a: 1 b: 5 c: 1 Expected Output The

Lab1:

Q1: Java program to solve quadratic equations (use if, else if and else)

Input Data a: 1 b: 5 c: 1 Expected Output The roots are -0.20871215252208009 and -4.7912878474779195

Q2: Java program that takes a number from the user and checks the input integer between 1 and 7 to display the name of the weekday.

Input Data Please enter a number: 4 Expected Output Wednesday

Q3: Java program to generate the following @'s triangle:

Input Data Input the number: 6 Expected Output

@

@@

@@@

@@@@

@@@@@

@@@@@@ Q4: Java program to declare an array with a name (courseArr) of size 5 and let a student fill it with his courses, and do the following:

  • Print all the elements of the array.
  • Let the program check if the array has "Java" course.
  • Copy the inserted array by the student to another one with a name (copiedArr).
  • Print coiedArr backward.

Input Data

Please enter course number 1: C++

Please enter course number 2: Python

Please enter course number 3: Java

Please enter course number 4: PHP

Please enter course number 5: C#

Expected Output

Courses array:

C++ Python Java PHP C#

Java course is in the courses array

Copied array:

C# PHP Java Python C++

Lab2:

(String & Files )

Q1:

Java program that takes from a lecturer (students' phones numbers) and store them to a file named (Students numbers.txt), then do the following:

  1. Read the numbers from the file, and insert them to a list.
  2. Check the numbers for which telecom company as follows:

079

Zain

078

Umniah

077

Orange

And print them with company name.

Q2:

Read data from the previous file and rewrite them to another file named (Students numbers2.txt),then print the data line by line in the console

Q3:

Read from the user 10 names and then print them with capitalizing the first letter of each name.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!