Project #25047 - intro to java

Question 1
Write a static method

int count(String s, char c)
in a class MyString, which takes a string s and a character c and returns the number of times the

character c occurs in s.
Write a
Main class with a main method that reads in a string and a then a character and prints the

number of time the characters occurs in the string.

Question 2

Write a static method

int[] count(String s)

which takes a string s and returns an array count, where count[i] is a count of the number of times the digit i occurs in s. So count[0] is the number of times 0 appears in s, count[1] is the number of times 1 appears in s, etc (up to count[9]).

Write a Main class with a main method that reads in a string and prints the number of times each digit occurs in the string.

Question 3

Write a static method

double[] read(String fileName) page1image10960page1image11120

in class MyArray which reads the contents of the file with the given name into an array, and returns that array

The file format will be as follows:

  • line 1 is an integer giving a count of the number of numbers in the file

  • the rest of the lines will each contain numbers separated by commas (so each line may contain more than one number, separated by commas, and one line may contain a different number of numbers to another line).

    Note: You MUST NOT use a Scanner for this. 

Subject Computer
Due By (Pacific Time) 03/14/2014 12:00 am
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy