Write a complete java method called sumnums

Assignment Help Basic Computer Science
Reference no: EM13899507

Part 1 - Methods - You will simply just write methods as the questions ask you to.

  1. 1. Write a complete Java method called sumNums that takes no parameters and returns an integer. The method uses a do-while loop to ask the user to enter a series of positive integer values and keeps a running total. Use a sentinel (-1) to allow the user to indicate when they are finished. The method returns the total.

2. Write a complete Java method called checkPassword that takes a String as a parameter (password) and returns a boolean. First, check that the password is at least 8 characters long. Then use a while loop to check that the password contains at least one digit. If the password has the correct length and contains a digit, return true, otherwise return false

3. Write a complete Java method called authenticate that takes two Strings (username, password) as parameters and returns a boolean. If the username parameter has the value "Chucky" and the password parameter has the value "Cheese1", return true. Otherwise return false.

4. Write a complete Java method called getScoreSheet that takes two ints as parameters (rows and columns) and constructs a 2-dimensional array of doubles (calles scores) with a size based on the rows and columns parameters. Use a nested loop to initialize each value in the array to 100.00. The method returns the scores array.

5. Write a complete Java method called writeList that takes an ArrayList of Strings as a parameter and writes each String as a line in a text file. Make sure to handle the Exception that might be thrown and print the error message to the command line.

Part 2 - Complete JAVA Program - You will write a complete JAVA program as requested below.

Write a complete Java program to compute the cost of your annual coffee consumption. (If you don't drink coffee, you can substitute tea, soda, or something else.)

The main method calls three methods to do this:

getDailyCost: requests from the user the estimated amount they spend on coffee on each day of the week, Sunday through Saturday. These values are stored in array of 7 doubles called dailyCost. The method returns this array.

getAnnualCost: takes an array of doubles as a parameter (the dailyCost array) and computes the annual cost for coffee (or tea, soda, etc). Assume 52 weeks in a year. The method returns the annual cost as a double.

printAnnualCost: takes a double (the annual cost) as a parameter and prints it to the command line as, for example: "Your estimated total meal plan cost is: $1375.00."

Reference no: EM13899507

Questions Cloud

Principle parts of a quality function deployment matrix : Describe the principle parts of a quality function deployment matrix. How is each of the principle parts of a QFD created? What does each part hope to provide the users
Calculate the amount of dividends dragoon paid : Calculate the amount of dividends Dragoon paid using the information given. Prepare a statement of cash flows using the indirect method.
Complete a swott analysis of mergers and acquisitions : Complete a SWOTT analysis of Mergers and acquisitions
Describe the three phases of the life history curve : Describe the three phases of the life history curve. Reliability programs have been used to prolong the lives of tornado sirens that signal the approach of bad weather. Describe a tornado siren in terms of the definition of reliability
Write a complete java method called sumnums : 1. Write a complete Java method called sumNums that takes no parameters and returns an integer. The method uses a do-while loop to ask the user to enter a series of positive integer values and keeps a running total. Use a sentinel (-1) to allow the u..
Calculate the amount of dividends firm a and firm b paid : Calculate the amount of dividends Firm A and Firm B paid using the information given. Prepare a statement of cash flows for each firm using the indirect method.
What is the probability that a blue chip will be drawn : The probability of drawing a pink chip from a bowl of different colored chips is 0.35, the probability of drawing a blue chip is 0.46, the probability of drawing a green chip is 0.15, and the probability of drawing a purple chip is 0.04. What is ..
Create sheet sales and put reasonable numbers : Create a file: Pizza_by_First_Last.xlsm . Create sheet Sales and put reasonable numbers for prices (your choice), add create formulas. Put the % for sales tax in H1 (it is 8% in NY).  After that, you need to put formulas in place, add a row for total..
Analyze common ethernet standards found in a switched lan : Analyze common Ethernet standards found in a switched LAN fabric. ? Summarize the nature of Ethernet frames that are processed in LAN switching.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Case study - ms powerpoint executive presentation

Case Study Part  - MS Powerpoint Executive Presentation

  Determine the contents of the relocation

A program was initally loaded into memory starting at address 500. Determine the contents of the relocation register after the program is moved to address 200?

  How many healthy class instances were correctly classified?

How many healthy class instances were correctly classified?

  In what ways do the experts foresee the use

Review the literature and analyze the strengths and weaknesses of both virtualization and cloud computing in providing secure and trusted systems.

  What specific challenges will virtualization

In the context of security and trust, what specific challenges will virtualization and cloud computing present across the software lifecycle?  In what ways do the experts foresee the use of each of these technologies evolving in the future?

  Describe four different kinds of wireless technologies in a

bull discuss four different types of wireless technologies in a 350- to 700-word paper in apa format.bull describe the

  Representing information by predicate-calculus sentences

Represent this information by predicate-calculus sentences in such a way that you can represent the question Is there a member of the alpine club

  How to use system tools to identify problems

How can you use system tools, such as the Task Manager, to help identify and troubleshoot these problems? Report your findings in a one page paper.

  Write a function to simulate the game show problem

Write a function to simulate the game show problem. Your function should randomly select locations for the prizes, select a door at random chosen by the contestant, and then determine whether the contestant would win or lose by sticking with the o..

  Explain the concept of supply chain management

Explain the concept of supply chain management. Although R/Way offers services rather than products, could that concept apply to the design of R/Way's new system? If so, how?

  Involved in implementing a database for the restaurant

Draw a conceptual ER diagram in Information Engineering format as discussed in the course that  describes the following aspects involved in implementing a database for the restaurant.

  Identify tactical

Conduct research to find examples of the differences between I.T. security controls and countermeasure gap analysis, and identify tactical, strategic, risk mitigation, threats, and vulnerability dimensions and gaps associated with compliance recom..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd