Question: Write a JAVA program using PROCESSING to answer the following Java question. In this question, students should work with the drawing text on the canvas.

Write a JAVA program using PROCESSING to answer the following Java question.

In this question, students should work with the drawing text on the canvas. The code will ask for a number and the code should be able to detect the type of the entered number; either it is an integer or float or even if it is not a number. Also, they need to know about input command and get string from users with input command. In order to do so, the library below should be imported at the beginning of the code: import javax.swing.JOptionPane;

The code should be written in a way that when it is run, if user presses button n on the keyboard, an input box like below appears on the screen.

Write a JAVA program using PROCESSING to answer the following Java question.

In the box above if user for example enters 3, the code should write the number of the type of that on the canvas like below:

In this question, students should work with the drawing text on the

The position of the strings on the canvas is optional and it should be selected in a way that it is readable.

Hint: In order to detect float numbers, look for character . In the entered string.

Below there are two more examples of the desired code:

canvas. The code will ask for a number and the code should

be able to detect the type of the entered number; either it

Question 2:

The program should be able to grab input by pressing n from user (4)

The program should be able to detect integer (4)

The program should be able to detect float (4)

The program should be able to detect a string which is not a number (4)

The program should be able to draw appropriate texts on the canvas (4)

IMPORTANT: Use PROCESSING to answer the following JAVA

is an integer or float or even if it is not a

Input x ? Enter a number: OK Cancel A3_02 Number: 3 Type: int A3.02 Input Number: 37.8m Press 'n' on the Keyboard ? Enter a number: 37. OK Cancel Type: Not a Number Processing Processing 3.5.4 File Edit Sketch Debug Tools Help Stop 10 Java Processing 1 import javax.swing.JOptionPane; 2 3 String enter Num; 4 5 void setup() { 6 size(500,500); 7 background (200); 8 fill(0); 9 textSize(40); enterNum= JOptionPane.showInputDialog("Enter a number: "); 11 | 12 } 10 13 14 15 void draw() { 16 17 } 18 19 20 21

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 Databases Questions!