a) To generate the student number it takes three letters(the first, middle and last letter) of the student’s surname and adds it to the first three letters from the first name, then finally adds a three digit postfix number.
b) To generate the email is quite easy it just takes the first letter from the first name and adds it to the surname , then it adds the @students.nust.na postfix
Your task is to create a program that can achieve the above requirements when given the students surname, first name and three digit postfix through CMD arguements
Your task is to create a program that can achieve the above requirements when given the students surname, first name and three digit postfix through CMD arguements
Sample run 1:
java InClass01_task01 Kandjeke Jenifer 003
Output: Good day Jenifer welcome to NUST.
Your email address is : jkandjeke@students.nust.na
Student number : KJEJEN003
Sample run 2:
java InClass01_task01 Kavezemba Terry 001
Output: Good day Terry welcome to NUST.
Your email address is : tkavezemba@students.nust.na
Student number : KZATER001
2.Suppose that the first number of a sequence is x, where x is an integer. Define a^0 = x; a^n+1 = 𝒂^𝒏/ 𝟐 if an is even; a^n+1 = 3a^n + 1 if an is odd. Then there exists an integer k such that a^k = 1. Write a program that prompts the user to input the value of x. The program outputs the integer k such that a^k = 1 and the numbers a^0, a^1, a^2,…a^k. (For example, if x = 75, then k = 14, and the numbers a^0, a^1, a^2,…ak, respectively, are 75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1. (Test your program for the following values of x : 75, 111, 678, 732, 873, 2048, and 65535)
9. Write a program that uses while loops to perform the following steps:
a. Prompt the user to input two integers: firstNum and secondNum.
(firstNum must be less than secondNum.)
b. Output all the odd numbers between firstNum and secondNum
inclusive.
c. Output the sum of all the even numbers between firstNum and
secondNum inclusive.
d. Output all the numbers and their squares between 1 and 10.
e. Output the sum of the squares of all the odd numbers between
firstNum and secondNum inclusive.
f. Output all the uppercase letters.
10. Redo Exercise 9 using for loops.
11. Redo Exercise 9 using do...while loops.
Write the java program in the following features of OOP:
1,Encapsulation
2,Polymorphism
3,Inheritance
4,Abstraction
Problem description Caf´e Wafflelicious, as its very name signifies, is a cafe that sells waffles. When customers arrive at this cafe, they design the waffle they want according to the kinds of waffles, their ingredients and their prices. The waitress delivers these orders to the cook from the customer. The cook is responsible for making the waffle. You will prepare an order system in which you will check the company’s waffle orders.For example, there is a waffle order from the customer. You need to expand the functionality of the class in a transparent and dynamic way.Waffle Types (Concrete component): Normal Waffle - $13.0 Belgian Waffle - $16.0 Wrap Waffle - $13.0 Wheat Waffle - $15.0 1 Free Gluten Waffle - $17.0 Toppings (Concrete decorator): chocolate - $2.0 for each (white, milky, dark, nutella and caramel) fruits - $0.5 for each (strawberry, kiwi, pineapple and banana) sauces - $1.0 for each (chocolate, caramel and raspberry) nuts - $1.0 for each (pistachio, almond, hazelnut and walnut)
Using any loop of your choice create a program that will prompts the user for two numbers and do calculations as follows, starting from the smallest number add the next number if its even or subtract it if its odd, repeat this until you get to the last number. i.e. if you start at 2 to 4, then 2 – 3 + 4( - because 3 is odd and + because 4 is even)