Suppose that the input is:
38 35 71 14 -1
What is the output of the following code? Assume all variables are properly declared.
sum = 0;
num = console.nextInt();
while (num != -1)
{
sum = sum + num;
num = console.nextInt();
}
System.out.println("Sum = " + sum);
1) Create a class named 'Member' having the following members:
Data members
1 - Name
2 - Age
3 - Phone number
4 - Address 5 - Salary
It also has a method named 'printSalary' which prints the salary of the members. Two classes 'Employee' and 'Manager' inherits the 'Member' class. The 'Employee' and 'Manager' classes have data members 'specialization' and 'department' respectively. Now, assign name, age, phone number, address and salary to an employee and a manager by making an object of both of these classes and print the value you assigned.
Write a program that asks the user to enter an account number as a string. The account number consists of 8
characters and is divided as follows:
The first 2 characters are digits and represent the branch (00 for Beirut, 01 for Saida, 02 for Tripoli).
The remaining 6 characters represent the customer’s account number
A valid account number consists of exactly 8 characters. If the account is valid, the program prints the details
(branch and account number). If the account is not valid, the program displays a message to the user.
Given list of students’ records. Write a program with signature as below:
Method Name: getStudentsWithMarksMoreThan()
Input: marks – Integer
Output: List of Students having marks more than input
Also add Unit Test case – both positive and negative.(Any high level language like – Java,
Python, PHP, C#, JavaScript)
Create an applet which take a number as input and display whether it is prime number or not. Use appropriate components, layout and formatting in your program in JAVA.
Write the pseudocode for an application that will:
a) Prompt a user for three numbers.
b) Store the values entered by a user in an array as they are provided by the user.
c) Ask a user if they would like to search for a value:
If the user wishes to search for a value, the user needs to be prompted for a value to search for. If the value is found, a notification needs to be provided to the user.
d) Use a for loop to cycle through the arrays to calculate and display the total of the values stored in the array
the logical structure in which one instruction occurs after another with no branching in java
to develop an object-oriented application. They provide trucks, cars, and bikes on rent for a maximum period of 5 days, and if the number of days increases they double the rent for the extra days. They have different cars like luxury, sports and ordinary and all of them are powered by both electricity and petrol while trucks have only petrol option. In the case of bikes, they have electric street-bike and sportbikes have only petrol option. Further, the choice of the customer for the trucks is based upon weight, length, and wheels. The owner of the company can add, view and update vehicle, customer, and employee information.
Create a Java Project With Your name as “YourNameProjectQNo1”, add a class to this Project, Class name should be Your Name with Your Reg No as “YourNameYourRegNo”
a. Add a Method to Accept names and marks of n students from user, enter the value of n from User
b. Ensure that valid data is entered. If user enters an invalid data, then appropriate message should be displayed using Message Dialog Box e.g. ‘Name cannot be a number’ or ‘Marks must be an integer value’
c. Add another Method, to Display this data in descending order according to marks such that name of student.