Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Write a program that reads a set of floating-point values. Use a while-loop with the condition: while (sc.hasNextDouble()) where sc is your Scanner object. This

1.Write a program that reads a set of floating-point values. Use a while-loop with the condition: while (sc.hasNextDouble()) where sc is your Scanner object. This will allow the user to keep entering numbers until they enter something other than a double. Before the loop starts, give them a prompt to enter a double number or 'q' to quit. In the loop, keep track of the smallest number and the largest number. To do this, use two variables - currentNum, maxNum and minNum. currentNum will be the number they enter each time through the loop. Compare it to maxNum and minNum, and assign it to one of those if it is larger or smaller. After the loop is finished, print the max and min numbers that were entered.

  • 2. Having a secure password is a very important practice, when much of our information is stored online. Write a program that validates a new password, following these rules:
    • The password must be at least 8 characters long.
    • The password must have at least one uppercase and one lowercase letter
    • The password must have at least one digit.

Write a program that asks for a password, then asks again to confirm it. Next, write a method: public static void checkPW(String pw1, String pw2)

If the passwords dont match or the rules above are not fulfilled, print a message that the password is not valid. Here are some tips for checking the password:

  • Use .equals() to compare two strings
  • Use a loop to check each character of the password. In the loop, use Character.isDigit() to check if a character is a digit or not. Use Character.isUpperCase(nextChar) and Character.isLowerCase(nextChar) to check if a character is upper or lower case (where nextChar is the next current character in your password string). You could use flag variables to set if a digit, upper, and lowercase letter are found.

3.Write a program that reads a word and prints the word in reverse. For example, if th e user provides the input "Harry" , the program prints yrraH

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

New Trends In Databases And Information Systems Adbis 2019 Short Papers Workshops Bbigap Qauca Sembdm Simpda M2p Madeisd And Doctoral Consortium Bled Slovenia September 8 11 2019 Proceedings

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Robert Wrembel ,Mirjana Ivanovic ,Johann Gamper ,Mikolaj Morzy ,Theodoros Tzouramanis ,Jerome Darmont

1st Edition

3030302776, 978-3030302771

More Books

Students also viewed these Databases questions

Question

Distinguish between the accrual of wages and the payment of wages.

Answered: 1 week ago