subject

There is an application which inputs hundred numbers from the user, if user enters a positive number it increments valid numbers count. But if a user enters other than integer it terminates. You are required to make changes in given code such that instead of termination it shows message “input is not valid” and re input a number. importjavax. swing.*;
publicclass QuestionNumber4 {
publicstaticvoidmain(String[] args) {
intcountValidNumber=0;
int num;
for(inti=0;i<100;i++){
System. out. print("Enter a Positive Number:");
String s1 =JOptionPane. showInputDialoge(“enter number”,null);
num = Integer. parseInt(s1);
if(num>0){
countValidNumber++;
}
}
System. out. println("Valid Numbers Are:"+countValidNumber);
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
Give an example of a case where a two-way handshake to establish a connection could leave one side of the connection live while the other side does not believe there is a connection.
Answers: 1
question
Computers and Technology, 22.06.2019 11:20
The kurt vonnegut commencement speech, the neiman-marcus chocolate chip cookie recipe, and the get-well emails to the dying boy are examples of select one: a. social engineering b. hoax emails c. email viruses d. worms
Answers: 1
question
Computers and Technology, 23.06.2019 01:40
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
You know the right answer?
There is an application which inputs hundred numbers from the user, if user enters a positive number...
Questions
question
English, 14.06.2021 21:50
question
Social Studies, 14.06.2021 21:50
question
Mathematics, 14.06.2021 21:50
Questions on the website: 13722359