Check Question

Estimate p) p can be computed using the following series: m(i) = 4*(1 - 1 /3 + 1 /5 -1/ 7 + 1/ 9 -1 11 + .. +(-1)^i+1 /2i-1 6.16 Write a method that returns m(i) for a given i and write a test program that displays the following table: VideoNote
Estimate p i m(i) 1 4.0000 101 3.1515 201 3.1466 301 3.1449 401 3.1441 501 3.1436 601 3.1433 701 3.1430 801 3.1428 901 3.1427 6.15(Number of days in a year) Write a method that returns the number of days in a year using the following header: public static int numberOfDaysInAYear(int year) Write a test program that displays the number of days in year from 2000 to 2020. 6.19 (The MyTriangle class) Create a class named MyTriangle that contains the following two methods: /** Return true if the sum of any two sides is * greater than the third side. */ public static boolean isValid( double side1, double side2, double side3)/** Return the area of the triangle. */ public static double area( double side1, double side2, double side3) Write a test program that reads three sides for a triangle and computes the area if the input is valid. Otherwise, it displays that the input is invalid. 6.20 (Count the letters in a string) Write a method that counts the number of letters in a string using the following header: public static int countLetters(String s) Write a test program that prompts the user to enter a string and displays the number of letters in the string. * 6.21 (Phone keypads)The international standard letter/number mapping for telephones is shown in Programming Exercise 4.15. Write a method that returns a number, given an uppercase letter, as follows: int getNumber(char uppercaseLetter) Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (uppercase or lowercase) to a digit and leaves all other characters intact. Here is a sample run of the program: Enter a string: 1-800-Flowers 1-800-3569377 Enter a string: 1800flowers

 

 

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      javaprogram6b.zip