Question

In this task you are asked to completely implement the following functions (ie. write both the...

In this task you are asked to completely implement the following functions (ie. write both the function header and function body)

1) You have been tasked to write a Processing function called isleapYear, which receives an integer representing a year. The function should return true if the year is a leap year and false otherwise. (For your information, a year is leap year if it is divisible by 4 but not 100, or is divisible by 400)

2) You have been tasked to write a Processing function called notVowel that receives a character and returns false if the character is a vowel and true otherwise. Vowels include uppercase and lowercase of the following characters: 'a', 'e',T,'o' and 'v'. (For the purposes of this exercise, is not a vowel.)

Programming language processing i3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

QUESTION NO 1:

import java.util.*;
class Main {
static boolean isleapYear(int num){ // get number

if (num % 4 == 0 && num % 100 != 0){ // if number is satisfied
return true; // return true
}
  
else if (num % 100 == 0 && num % 400 == 0){
return true;
}
  
else // else return false
{ return false;
}
}
public static void main(String[] args) {
System.out.println("" + isleapYear(2050));
}
}

QUESTION NO 2:

import java.util.*;

class Main {

static boolean notVowel (char charac){ // get character

// if they are vowel return true

if(charac=='a'|| charac =='A'|| charac =='e' || charac=='E'|| charac=='T' || charac=='t' || charac=='o' || charac=='v' || charac=='O'|| charac=='V'){

return true;

}

else // else return false

{ return false;

}

}

public static void main(String[] args) {

System.out.println("" + notVowel('a'));

}

}

IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW

PLEASE GIVE A THUMBS UP

Add a comment
Know the answer?
Add Answer to:
In this task you are asked to completely implement the following functions (ie. write both the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ language Write a program that contains the following functions, i. A function isVowel that takes...

    c++ language Write a program that contains the following functions, i. A function isVowel that takes in a character and returns true if it is a vowel and false otherwise ii. A function that request from the user to enter in a sequence of characters, and outputs the number of vowels entered. (Use Function in a) to assist you, a sentinel value can be used to specify the end of the user input iii. A function that reads 3 test...

  • In Java, write a program that prompts the user to input a sequence of characters and...

    In Java, write a program that prompts the user to input a sequence of characters and outputs the number of vowels. You will need to write a method to return a value called isAVowel which will return true if a given character is a vowel and returns false if the character is not a vowel. A second method, called isAConstant, should return true if a given character is a constant and return false if the character is not a constant....

  • ----JAVA IMPLEMENTATION URGENTLY NEEDED ------ //Ques 3 /** * Computes the standard Rayleigh distribution probability density...

    ----JAVA IMPLEMENTATION URGENTLY NEEDED ------ //Ques 3 /** * Computes the standard Rayleigh distribution probability density function (The mathematical function describing the standard Rayleigh distribution is given by: y = [ x / (σ)^2 ] * e ^ [ (-x^2) / (2σ^2) ] where σ =sigma is the scale variable of Rayleigh distribution. The function y is called the probability density function of the standard Rayleigh distribution. Complete the method rayleigh(double x, int sigma) that returns the value of y...

  • Python Programming Task 2: Leap Years   Part A - Is this a leap year? Write a...

    Python Programming Task 2: Leap Years   Part A - Is this a leap year? Write a function is leap year(year) that calculates whether a given (CE) year is a leap year. The function must: • take one argument: a positive integer representing a year (assumed to be CE) • return True if that year was a leap year; return False if not NOTE: all years that are divisible by four are leap years, unless they are also divisible by 100,...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • Write a program(Python language for the following three questions), with comments, to do the following:   ...

    Write a program(Python language for the following three questions), with comments, to do the following:    Ask the user to enter an alphabetic string and assign the input to a variable str1. Print str1. Check if str1 is valid, i.e. consists of only alphabetic characters. If str1 is valid Print “<str1> is a valid string.” If the first character of str1 is uppercase, print the entire string in uppercase, with a suitable message. If the first character of str1 is...

  • C++ PROGRAMMING Implement a bool function whose header is given below. Inside the function, declare, ask,...

    C++ PROGRAMMING Implement a bool function whose header is given below. Inside the function, declare, ask, and get a character from the user. The function will return true if the character the user enters is NOT in either of the words, otherwise it will return false. Keep in mind that uppercase and lowercase letters are not the same. You will need to change both words and the character input by the user to the same case (upper or lower) -...

  • You're to write a C++ program that analyzes the contents of an external file called data.txt....

    You're to write a C++ program that analyzes the contents of an external file called data.txt. (You can create this file yourself using nano, that produces a simple ASCII text file.) The program you write will open data.txt, look at its contents and determine the number of uppercase, lowercase, digit, punctuation and whitespace characters contained in the file so that the caller can report the results to stdout. Additionally, the function will return the total number of characters read to...

  • In C++: You are to write two functions, printString() and testString(), which are called from the...

    In C++: You are to write two functions, printString() and testString(), which are called from the main function. printString (string) prints every character in the string to std::cout with a space after every character and a newline at the end. testString (string) returns true if the string contains characters that are in sorted order, false otherwise. You may assume that all characters are lowercase and only alphabetical characters are present. See the main() to see how the two functions are...

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT