Create a new string called passwd

Assignment Help JAVA Programming
Reference no: EM13802285

In this assignment, you may use your knowledge of the following concepts:

1) Math (+, %, ++, +=) and relational operators (!=, ==, <,>)
2) For loop, if-else
3) Arrays - accessing elements in a location, finding the length of the array
4) String class - length(), toCharArray(), charAt(),substring()
5) Making a simple method call to built-in classes and sending an input (known as argument)

Create a class called Hw1FirstLastName.javain a project called hw1firstlastname

In the main method of this class file, create a string called sentence and assign it a word or sentence of your choice. The rest of the assignment involves working with the contents of this sentence. You should test and ensure that your program works with sentences of different lengths and characters (letters/numbers/special characters).

We will use this sentence as a password starting phrase to automatically create a new password as follows.

Task 1. Create a new string called passwd formed by concatenatingevery alternate non-spacecharacter in sentencestarting with the first. To do this, you need to a loop to go through the string sentence and retrieve characters from alternate index positions. If the extracted alternate character is NOT a space, then add it to the new String. Do not include spaces.
Print out the following.
<Output> The starting sentence is: ___________
<Output> The password in task 1 is: ___________

Task 2. If the length of passwd is even, extract a substring which is the first half of passwd and use this as the new passwd. Leave passwd as is if its length is odd. Print this passwd.
<Output> The password in task 2 is: ___________

Task 3. Convert passwdfrom task 2 to a character array called pwdArray. Sum the numeric value (Unicode value) of all the characters in pwdArray. To do this, create a new int variable called sum, and in a loop, add each char obtained from the array to sum (the underlying int value of the char will be obtained and added to sum). Once the loop has ended, divide this sum by 2 if the sum is even, or leave it as it is if the sum is odd. Then append the sum to the end of the passwd.
Print out the following.
<Output> The new password in task 3 is: ___________

Reference no: EM13802285

Questions Cloud

What is not considered a cloud application : One day you decide to turn in a resource paper that you found on the Internet. What is not considered a Cloud application
Political party loyalty or campaign money may influence : Discuss fact-based evidence about how interest groups, political party loyalty, or campaign money may influence your representative. Can these influences weaken his or her effectiveness as a true "representative" of the district
Making effective and ethical decisions : Complete the experiential exercise 5.1 Assessing Yourself at the end of the chapter, "Ethics and Corporate Responsibility." Based on your score, create a plan to increase your skills in making ethical decisions in the workplace.
Visual language and culture paper : Visual Language and Culture Paper
Create a new string called passwd : Create a class called Hw1FirstLastName.javain a project called hw1firstlastname. Create a new string called passwd formed by concatenatingevery alternate non-spacecharacter in sentencestarting with the first
Inefficiencies in managing human resources : Inefficiencies in Managing Human Resources
Homeland security and emergency management : What challenges exist or may emerge as a result of unclear pathways of command, control/coordination, and convergence during disaster or incident response operations?
What are your thoughts regarding monopolies : What are your thoughts regarding Monopolies? Do you think Microsoft still runs a Monopoly? Why should they be penalized for having "all the ideas
Write a paper about language development in the primary year : Write a paper about Language Development in the Primary Years.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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