String Challenge Have the function String Challenge (strArr) take the strArr parameter being passed, which will only con

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

String Challenge Have the function String Challenge (strArr) take the strArr parameter being passed, which will only con

Post by answerhappygod »

String Challenge Have The Function String Challenge Strarr Take The Strarr Parameter Being Passed Which Will Only Con 1
String Challenge Have The Function String Challenge Strarr Take The Strarr Parameter Being Passed Which Will Only Con 1 (65.72 KiB) Viewed 112 times
String Challenge Have the function String Challenge (strArr) take the strArr parameter being passed, which will only contain a single element, and return the string true if it is a valid number that contains only digits with properly placed decimals and commas, otherwise return the string false. For example: if strArr is ["1,093,222.04"] then your program should return the string true, but if the input were ["1,093,22.04"] then your program should return the string false. The input may contain characters other than digits. Examples Input: new String[] {"0.232567"} Output: true Input: new String[] {"2,567.00.2"} Output: false
import java.util.*; import java.io.*; class Main { } public static String StringChallenge (String[] strArr) { // code goes here return strArr [0]; } public static void main (String[] args) { // keep this function call here Scanner s = new Scanner(System.in); System.out.print(String Challenge (s.nextLine())); }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply