Our Services

Get 15% Discount on your First Order

[rank_math_breadcrumb]

complete the method named countdown (method stub provided) so that it accepts an int countFrom as its parameter and prints each number from countFrom to 1 on a single line separated by a space. Thi

complete the method named countdown (method  stub provided) so that it accepts an int countFrom as its parameter and  prints each number from countFrom to 1 on a single line separated by a  space. This method should not return anything (void return type).

Hint:  Use a loop and think about the starting value you want to print, the  ending value that will print, and how you want to update the value  between iterations.

Example: countdown(5) should print: 5 4 3 2 1  Example2: countdown(-1) should not print anything. Example3: countdown(9) should print: 9 8 7 6 5 4 3 2 1  

Ensure you are thoroughly calling and testing your methods before submitting to zyBooks.

Problem 2 – Arrays as Parameters

Complete  the curve method (method stub provided for you) so that it loops  through the int[] grades, incrementing each non-zero grade by 2. Grades  of 0 should not be changed. This method should not print or return  anything, but should modify the contents of the grades array.

Hint – you can test that your method works in main by printing the values in grades both before and after this method is called.

Example: Passing in an int[] containing: {95, 80} should modify the array to {97,82} Example2: Passing in a int[] containing: {70, 0, 99} should modify the array to {72, 0, 101}  

Problem 3 – Returning Arrays, Arrays as Parameters, String methods

Write  a method named acronyms that accepts an array of type String as its  parameter and returns an array of type char. This method stub is not  provided for you. Method name, return type, and parameter(s) should  match exactly to receive credit. You should not use the keyword static  in the method header.

Your method should  create a new char array the same size as the String array passed in.  You should then use a loop to populate the char array with the first  letter of each individual String stored in the array.

Hint – the charAt method in the String class retrieves a single char from a specified index.

Example:  Passing in an String[] containing: {“tiger”, “king”} should return a  char[] of size 2 containing {‘t’, ‘k’} Example2: Passing in an String[] containing: {“go dawgs”, “uga”, “java”}  should return a char[] of size 3 containing {‘g’, ‘u’, ‘j’} 

Problem 4 – Scanner in methods, String methods, Algorithm design, Return Statements

Write  a method named setPassword that accepts a Scanner object as its  parameter and returns a boolean. This method stub is not provided for  you. Method name, return type, and parameter(s) should match exactly to  receive credit. You should not use the keyword static in the method  header.

Your method should read in a  String password using the nextLine method and the the Scanner object  passed in as the method parameter. Your method should then return either  true or false depending on if all criteria of a password is met.

A valid password (returning true) would have the following criteria:

  • The password contains at least 8 characters
  • The password contains at least 1 capital letter/char
  • The password contains at least 1 lowercase letter/char

If  ALL of the above conditions are met, your method should return true. If  any of the above conditions are NOT met, your method should return  false.

Example: a user input of “Coding99” or “Java12345” would return true Example2: a user input of “Java123” would return false //only 7 characters Example3: a user input of “JAVA12345” would return false //no lowercase Example4: a user input of “java12345” would return false //no uppercase

import java.util.Scanner; //imported for you!

public class Exam2{//Problem 1   public void countdown(int countFrom)   {       //YOUR CODE HERE   } 

   //Problem 2   public void curve(int[] grades)   {       //YOUR CODE HERE   } 

//Problem 3   //method stub not provided – YOUR CODE HERE 

   //Problem 4   //method stub not provided – YOUR CODE HERE

}

import java.util.*; //All items in java.util package (Scanner, ArrayList, HashSet, etc.) imported for youpublic class Main{  public static void main(String[] args)  {        //You can test your code here.         //This file is not graded.  } 

}

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Part 1Title: Computer Hardware Using bullet points, briefly describe a computing device you use often, such as your desktop, laptop, tablet, or smartphone. Identify the make and model, and at least th

Part 1Title: Computer Hardware Using bullet points, briefly describe a computing device you use often, such as your desktop, laptop, tablet, or smartphone. Identify the make and model, and at least three other components of the computing device. In the speaker notes, discuss in detail what you use the device

Network Threats and Attacks You have now learned about recognizing security threats, vulnerabilities, and how to mitigate them. Almost every day, there are reports of an intrusion, breach of confident

Network Threats and Attacks You have now learned about recognizing security threats, vulnerabilities, and how to mitigate them. Almost every day, there are reports of an intrusion, breach of confidentiality, or some other high-profile attack. Find a news article about a recent network attack (no more than one year ago).

I am doing IFSM 300 Information Systems in Organization. the instructions The Stage 4 case study project is due as shown in the schedule. The assignment instructions and vendor brochure are attached.

I am doing IFSM 300 Information Systems in Organization. the instructions The Stage 4 case study project is due as shown in the schedule. The assignment instructions and vendor brochure are attached. The Case Study is posted under Course Resources. Use the Case Study and weekly readings to develop your assignment and understand the concepts

Find 5 student organizations that interest you. For each organization: Why are you interested in this organization?Describe some of the activities of the organizationWhen and where is the next meeti

Find 5 student organizations that interest you.  For each organization: Why are you interested in this organization? Describe some of the activities of the organization When and where  is the next meeting? If you have questions about the organization, how would you contact them?CSE1106 – Intro to Computer Science and

Network Threats and Attacks You have now learned about recognizing security threats, vulnerabilities, and how to mitigate them. Almost every day, there are reports of an intrusion, breach of confident

Network Threats and Attacks You have now learned about recognizing security threats, vulnerabilities, and how to mitigate them. Almost every day, there are reports of an intrusion, breach of confidentiality, or some other high-profile attack. Find a news article about a recent network attack (no more than one year ago).

Linux in Action (Required/Graded) Review this Linux case study. In particular, review the section titled “Results.” Share your thoughts on Linux after reviewing this study. Did you learn anything tha

Linux in Action (Required/Graded)  Review this Linux case study. In particular, review the section titled “Results.” Share your thoughts on Linux after reviewing this study. Did you learn anything that surprised you? Did it influence your opinion about Linux? Why or why not? In addition to your primary forum response, post

Linux Project and Virtualization (Required/Graded) Next week, the final element of your project will be due. In this phase, you’ll install Linux into a virtual machine and demonstrate some Linux comm

Linux Project and Virtualization (Required/Graded)  Next week, the final element of your project will be due. In this phase, you’ll install Linux into a virtual machine and demonstrate some Linux commands. A vital element of the project is virtualization. Have you previously used virtualization tools, such as VMware, VirtualBox, HyperV,

Careers in Linux System Administration (Required/Graded) SubscribeChoose from one of the following options. Be sure to include the option number in your response. 1. Job Search Use Indeed.com, Monst

Careers in Linux System Administration (Required/Graded) SubscribeChoose from one of the following options. Be sure to include the option number in your response. 1. Job Search Use Indeed.com, Monster.com, or LinkedIn.com to research IT job careers that require Linux Administration skills in your area. You can use keywords such as "Linux

Write a Java program as follows:1. Prompt the user on which action they want to take:a. Convert cubic feet to U.S. bushelsb. Convert miles to kilometersc. Determine graduation with honors titled. Exit

 Write a Java program as follows:1. Prompt the user on which action they want to take:a. Convert cubic feet to U.S. bushelsb. Convert miles to kilometersc. Determine graduation with honors titled. Exit program2. Programs at a minimum must have the following methods:a. Convert cubic feet method that gets cubic feet

Calculator Server and Client Java The goal: Make a client that sends simple arithmetic expressions, and a server that solves them and sends the result back to the client. Class design requirements:

Calculator Server and Client  Java  The goal: Make a client that sends simple arithmetic expressions, and a server that solves them and sends the result back to the client.  Class design requirements:  Your program should contain at least the following classes • CalculatorClient • CalculatorServer Important note: This is an

This is about java. I would appreciate your help! Please do not provide a “copy and paste answer”! Among other things, the purpose of this assignment is to assess the student’s ability to write a pro

This is about java. I would appreciate your help! Please do not provide a “copy and paste answer”!  Among other things, the purpose of this assignment is to assess the student’s ability to write a program dealing with window events, mouse events, and the Delegation Event Model. PROGRAM SPECIFICATIONS Beginning

The following program draws an BB-8 as shown below. Modify the program to move the BB-8 left or right using the arrow keys. The program can be download from the CMS. Please use Javafx   import java

The following program draws an BB-8 as shown below.  Modify the program to move the BB-8 left or right using the arrow keys.  The program can be download from the CMS. Please use Javafx  import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Line; import javafx.stage.Stage;