1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tiny-mole [99]
3 years ago
9

Complete the do-while loop to output every number form 0 to countLimit using printVal. Assume the user will only input a positiv

e number. For example, if countLimit is 5 the expected output will be 0 1 2 3 4 5
import java.util.Scanner;

public class CountToLimit {

public static void main (String [] args) {

Scanner scnr = new Scanner(System.in);

int countLimit = 0;

int printVal = 0;

// Get user input

countLimit = scnr.nextInt();

printVal = 0;

do {

System.out.print(printVal + " ");

printVal = printVal + 1;

} while ( /* Your solution goes here */ );

System.out.println("");

return;

}

}

Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with newline Ex: For the user input 123, 395, 25, the expected output is:

Enter a number (<100):
Enter a number (<100):
Enter a number (<100):
Your number < 100 is: 25
import java.util.Scanner;

public class NumberPrompt {

public static void main (String [] args) {

Scanner scnr = new Scanner(System.in);

int userInput = 0;

/* Your solution goes here */

System.out.println("Your number < 100 is: " + userInput);

return;

}

}
Computers and Technology
1 answer:
elena-s [515]3 years ago
7 0

Answer:

PART ONE

  1. import java.util.Scanner;
  2. public class CountToLimit {
  3.    public static void main(String[] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        int countLimit = 0;
  6.        int printVal = 0;
  7.        // Get user input
  8.        System.out.println("Enter Count Limit");
  9.        countLimit = scnr.nextInt();
  10.        do {
  11.            System.out.print(printVal + " ");
  12.            printVal = printVal + 1;
  13.        } while ( printVal<=countLimit );
  14.        System.out.println("");
  15.        return;
  16.    }
  17. }

PART TWO

  1. import java.util.Scanner;
  2. public class NumberPrompt {
  3.    public static void main (String [] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        System.out.print("Your number < 100: ");
  6.       int  userInput = scnr.nextInt();
  7.      do {
  8.           System.out.print("Your number < 100: ");
  9.           userInput = scnr.nextInt();
  10.       }while (userInput>=100);
  11.        System.out.println("Your number < 100 is: " + userInput);
  12.        return;
  13.    }
  14. }

Explanation:

In Part one of the question, The condition for the do...while loop had to be stated this is stated on line 14

In part 2, A do....while loop that will repeatedly prompt user to enter a number less than 100 is created. from line 7 to line 10

You might be interested in
16
mihalych1998 [28]

Answer:

Connecting a new computer to the network.

4 0
3 years ago
Compare and contrast the following codes of ethics, including a listing of their similarities and differences: The ACM Code of E
lora16 [44]

Answer:

Please see the explanation

Explanation:

ACM professional code has following characteristics:

Genaral moral Imperative- This further consists of:

Contribute to society and human well being

Avoid harm to others

Be honest and trustworthy

Honor property rights including copyrights and patent

Respect the privacy of other

2) Professional responsibilities

Acquire and maintain professional coompetence

Achieve the highest quality

Accept and provide appropriate professional review

Respect the existing laws

Access computing and communication resources only when authorized to do so.

3) Organizational leadership

Articulate social responsibilities of members of an organizational unit and encourage full acceptance of those responsibilities.

Manage personnel and resources to design and build information systems that enhance the quality of working life.

Ensure that users and those who will be affected by a system have their needs clearly articulated during the assessment and design of requirements; later the system must be validated to meet requirements.

Create opportunities for members of the organization to learn the principles and limitations of computer systems.

4) Compliance with Code

Uphold and promote the principles of this Code.

Treat violations of this code as inconsistent with membership in the ACM.

Software Engineering Code of Ethics and Professional Practice

In accordance with their commitment to the health, safety and welfare of the public, software engineers shall adhere to the following Eight Principles:

Public: Software engineers shall act consistently with the public interest.

Client and Employer: Software engineers shall act in a manner that is in the best interests of their client and employer, consistent with the public interest.

Product: Software engineers shall ensure that their products and related modifications meet the highest professional standards possible.

Judgement: Software engineers shall maintain integrity and independence in their professional judgment.

Management: Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance.

Profession: Software engineers shall advance the integrity and reputation of the profession consistent with the public interest.

Colleagues: Software engineers shall be fair to and supportive of their colleagues.

Self: Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.

Australian Code of Professional Conduct

As an ACS member you must uphold and advance the honour, dignity and effectiveness of being a professional. This entails, in addition to being a good citizen and acting within the law, your conformance to the following ACS values.

1. The Primacy of the Public Interest

You will place the interests of the public above those of personal, business or sectional interests.

2. The Enhancement of Quality of Life

You will strive to enhance the quality of life of those affected by your work.

3. Honesty

You will be honest in your representation of skills, knowledge, services and products.

4. Competence

You will work competently and diligently for your stakeholders.

5. Professional Development

You will enhance your own professional development, and that of your staff.

6. Professionalism

You will enhance the integrity of the ACS and the respect of its members for each other.

In a situation of conflict between the values, The Primacy of the Public Interest takes precedence over the other values.

This Code of Professional Conduct is aimed specifically at you as an individual practitioner, and

is intended as a guideline for your acceptable professional conduct. It is applicable to all ACS

members regardless of their role or specific area of expertise in the ICT industry

All the three codes focus on the public interest, honestl, loyalty, ensuring quality of life, and professional development.

In Australian Code of conduct, in a situation of conflict between the values, The Primacy of the Public

Interest takes precedence over the other values, while there is no such thing in other two codes.

Software Engineering Code of Ethics and Professional Practice includes development of self, that is, Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession, which is not usually seen in other two codes.

8 0
3 years ago
Which of the following comments are correct? Select all that apply.
AnnZ [28]

Answer:

1/ hello

Explanation:

7 0
3 years ago
Which type of document should Omar print?
Zinaida [17]

Well it depends on the topic he is doing. if it is a list then a plain doc with a list of numbers. if he is writing a letter then he should use the letter template.

7 0
3 years ago
Read 2 more answers
you are connected to a router. to provide access to the internet, you need to create a rule that would hide private ip addresses
kondor19780726 [428]

Based on the above, the technology that a person need to use is NAT.

<h3>What does Network Address Translation means?</h3>

The term Network Address Translation (NAT) is said to be the act or the process by which a person uses in mapping an internet protocol (IP) address to a given  place by altering the header of IP packets while in movement via a router.

Note that the Network Address Translation (NAT helps to boast as well as develop the security and lower the number of IP addresses an organization requires.

Hence, Based on the above, the technology that a person need to use is NAT.

Learn more about Network Address Translation from

brainly.com/question/24159022
#SPJ4

See full question below

You are connected to a router. To provide access to the internet, you need to create a rule that would hide private IP addresses behind one public IP address. Which technology should you use? (DHCP, Port forwarding, WPA, NAT)

8 0
2 years ago
Other questions:
  • Which sector provides scope for multimedia designers?
    10·1 answer
  • Cd-roms typically use the _______ filesystem type.
    11·1 answer
  • Help me!!!!! This is the last question! HELP ME! I REPEAT: HELP ME!!!! I AM SO IN NEED!!!
    12·2 answers
  • Conformity is the acceptance of culturally approved goals and the means for achieving these goals.
    6·2 answers
  • During slide show mode, hitting the B key will do which of these things?
    14·2 answers
  • Where does communication take place?
    12·1 answer
  • Using a for loop, print the decimal equivalents of ½, 1/3, ¼, … 1/10. Also, using a while loop, print the decimal equivalents of
    6·1 answer
  • Betty removed a web page from her website. Some users were browsing on her website. One of them clicked on a particular link and
    15·1 answer
  • Match the features of a word processing software to their corresponding functions.
    8·1 answer
  • Select the correct answer.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!