Function and array in java script, JAVA Programming

Assignment Help:

Specifications

1. readNumberOfEntries→ This function will ask the user for a value greater than or equal to two. The function will keep asking values as long as the user provides a value less than two. For each incorrect value the function will print (using alert) the message: 

"Error: Number must be greater than or equal to 2"

The function will end once a correct value is provided (the function returns this value).

2. isSorted→ This function will verify whether a set of values are sorted (in increasing order). The function will read a set of values from the user and will return true if the set of values are sorted and false otherwise. You must use the readNumberOfEntries function described above in order to read the number of entries the user will provide. The actual entries are read by the isSorted function.

3. isPalindrome→ This function will verify whether a set of values represent a palindrome. We define a palindrome as a set of numbers that when read from left to right and from right to left, present the same set of values. For example, the following are considered palindromes:

4. Example1:             10    20    105.   

6. Example2:             10    10

The following are not considered palindromes:

                Example1:             10    20    8

                Example2:             10    20

You must use the readNumberOfEntries function described above in order to read the number of entries the user will provide. The values the user provides must be read by this function and they should be stored in an array. Once in the array, your code should determine whether the values represent a palindrome.


Related Discussions:- Function and array in java script

Explain role of actionservlet , ActionServlet performs the role of Contro...

ActionServlet performs the role of Controller: ? Process user requests ? Verify what the user is trying to achieve according to the request ? Pull data from the model (if

What are synchronized methods and synchronized statements, What are synchro...

What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only implements a synchronize

Why hub is used in networks, Why hub is used in networks? HUB: Hub is n...

Why hub is used in networks? HUB: Hub is networking component that can be used to connect the networks and it could also be used to extend the size of networks. In a simple way

Enumerate the concept of write once run anywhere - java, Enumerate the conc...

Enumerate the concept of write once run anywhere - JAVA Java has introduced concept of WORA (write once run anywhere). When you write a java program it is called source code of

What is the actionform, ActionForm is javabean which shows the form inputs ...

ActionForm is javabean which shows the form inputs containing the request parameters from the View referencing the Action bean.

Difference between static and non-static variable, What is the difference b...

What is the difference between static and non-static variables? A static variable is associated with the class as a whole rather than with specific instances of a class. Non-st

Design a game in java, The game of Kala is played on a rectangular board: ...

The game of Kala is played on a rectangular board: In front of each player are six pits numbered 1 to 6 (called the 'side pits'). To the right of a player's side pits is a

What are the usages of package in java? , It helps to resolve naming confli...

It helps to resolve naming conflicts when different packages have classes with the same names. This also helps you prepare files within your project. As define : java.io package d

Explain what is multilevel inheritance, Explain what is Multilevel Inherita...

Explain what is Multilevel Inheritance ? The Car-Motorcycle-MotorVehicle instances showed single-level inheritance. There's nothing to stop you from going next. You can describ

Write Your Message!

Captcha
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