Reference no: EM133791649
Assignment: Java
Learning Outcome
Explain the basic principles of programming, concept of language, and universal constructs of programming languages.
Develop a program based on specification using programming language elements including syntax, data types, conditional statement, control structures, procedures, arrays, objects and classes.
Task
Question I
i. Explain two roles of the java virtual machine as part of java runtime environment?
ii. Describe the intermediate representation of a Java program that allows a JVM to translate a program into machine-level assembly instructions.
Question II
Create a Java program that does the following:
i. Prompt the user for an input.
ii. Enter your first and last names as the input.
iii. Read the entered input into two variables (one variable stores the first name while the other stores the last name).
iv. Using the printf function, print the variables in upper-case characters and each in a separate line.
(include screenshots of all program execution steps)
Question III
The cubic polynomial function of the third degree can be represented as:
y = ax3 + bx2 + cx + d
i. Write the correct Java representation of the function without using parentheses using the Rules of Operator Precedence.
ii. Evaluate the java representation of the function and find the value of y when,
x=3, a=1, b=2, c=3, d=4
Make sure that you show all the steps in detail.
iii. Use parentheses to rewrite the java representation.
Question IV
Write a java program that asks the user to enter his/her name. Print a welcome message and ask the user to enter a number. Then, tell the user the type of the number (positive, negative, or zero).