Using the ternary operator ( ? : ), write a Java program that prompts the user to input an integer and then checks if the number is positive or negative or equal to zero.
Write a Java program that asks the user to enter an integer number N and successively display all the odd numbers that are less than or equal to N.
Improve the program so that it also displays the number of odd numbers
less than or equal to N.
Solution in java ONLY plz... FULL question can be found on the following link http://ntci.on.ca/compsci/java/ch5/5_9.html ---> question 14
I cannot put full question here as its too long... so full question is on the link
The requirement is for it to NOT be done with import java.io.*; etc..... just directly
Thanks, appreciate it
----------------------------------------------------------------------------------
Write a program that prints portions of Pascal's triangle. The program should repeatedly ask the user to supply the number of rows in the triangle, terminating when the user supplies the value zero. In printing a triangle, the first value in the last row should appear in the first column and each preceding row should start printing three spaces further right........
Retail store has preferred Customer plan. The amount of customer discount is determined by amount of customercumulative purchases in store. When preferred customer spends $500, he gets 5% discount on future purchases. When preferred customer spends $1,000, he gets 6% discount on future purchases. When preferred customer spends $1,500, he gets 7% discount on future purchases. When preferred customer spends $2,000, he gets 10% discount on all future purchases. Design class named PreferredCustomer which is derived from CustomerData class. PreferredCustomer class have:purchasesAmount (a double) ,discountLevel (a double).The purchasesAmount variable holds total of customer’s purchases to date. The discountLevel variable should be set to correct discount percentage according to store preferred customer plan. Also calculate discount Amount based on discount. Now in Main class create ArrayList and add customers into it and display the customers details purchase of each customer along with discount he gets
Write a program that will
help an elementary school student learn multiplication. Use a
SecureRandom object to produce two positive one-digit integers. The
program should then prompt the user with a question, such as
How much is 6 times 7?
The student then inputs the answer. Next, the program checks the student’s
answer. If it’s correct, display the message "Very good!" and ask another
multiplication question. If the answer is wrong, display the message:
"No. Please try again." and let the student try the same question
repeatedly until the student finally gets it right. A separate “method” should
be used to generate each new question. This method should be called once
when the application begins execution and each time the user answers the
question correctl
Write a program that will
help an elementary school student learn multiplication. Use a
SecureRandom object to produce two positive one-digit integers. The
program should then prompt the user with a question, such as
How much is 6 times 7?
The student then inputs the answer. Next, the program checks the student’s
answer. If it’s correct, display the message "Very good!" and ask another
multiplication question. If the answer is wrong, display the message:
"No. Please try again." and let the student try the same question
repeatedly until the student finally gets it right. A separate “method” should
be used to generate each new question. This method should be called once
when the application begins execution and each time the user answers the
question correctl
you have been an integer array A of size N.you need to pfint the number with the value closest to zero.if there are multiple elements print the number with greater value.
Write a Java application and use a two-dimensional array that will store the five top artist sales for 2017. The application must also hold the artist sales for CDs, DVDs and BLU RAY items. Do not forget to use the marking guideline on the next page to see how the marks are allocated for this question. Your program must: Q.1.1 Create a two-dimensional array to contain the three sale items for five different artists. A single array must be used to store the artist names. ARTIST NAME CD SALES DVD SALES BLU RAY SALES Ed Sheeran 900 000 800 000 500 000 Pink 700 000 500 000 500 000 Bruno Mars 800 000 100 000 50 000 Foo Fighters 100 000 200 000 200 000 Taylor Swift 300 000 100 000 50 000 Q.1.2 Allow a user to enter in a number, ranging from 1 to 5, which will represent the artist position with regards to the album sales. Q.1.3 Printout the artist name including the CD, DVD, BLU RAY sales amounts and total sales
Develop a Java GUI application that will produce an Area lookup application that will allow a user to view a phone or postal code for a Town in a particular Country. Do not forget to use the marking guideline at the end of this question to see how the marks are allocated. Q.2.1 On the form create two combo boxes, one for the country selection and another to select a town. Also, add two radio buttons for the user to select to display either a phone or postal code. Q.2.2 You are also required to create a “submit” and “exit” button. The layout of the form is left to your discretion. Marks will be allocated to the presentation and effectiveness of the layout, but the following layout is displayed for your convenience.
Write a CGPA class that has a constructor for initializing four variables: name, matric number, level, and course of study, The program should have two other overloaded methods, one for collecting the credit unit of each course and the other for collecting points based on the grades of each student in each of the courses. Write a third method for calculating the CGPA of a number of students and return the names, matric numbers, levels, course of study, and their current CGPA, well-arranged (using format specifier if necessary). Execute the program using 5 records. Turn in the codes and a snapshot of the result on google classroom.