1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vanyuwa [196]
3 years ago
10

In the written Hawaiian language, only 13 letters are used: the five vowels (a,e,i,o, and u), and 8 consonants (h,k,l,m,n,p,w, a

nd ` (this backwards apostrophe is called an `okina, and is considered a consonant)). (Unfortunately, there is no easy way to write the kahako in ascii text). For this problem you should write two functions, int is_vowel(char); and int is_h_consonant(char); which are each given a character and return True or False. The function is_vowel() returns True is the character is a vowel (upper or lower case), and is_h_consonant() returns True if the character is a consonant (upper or lower case) in written Hawaiian.
You should write a simple (throw away) test driver to test your functions. Be sure you prompt the user (grader) of your test driver on what they should do to test your program. You should write this program in two files; driver1.c containing your test driver, and letters.c containing your functions. You should also have a file, letters.h, containing the prototypes and macros used in letters.c. I have provided a makefile for you in ~ee160/Homework/Hw3 which you can copy to your Hw3 directory. To compile this program, use the command:

make driver1
THIS IS WHAT I HAVE SO FAR:

LETTERS.C

#include"letters.h"

int is_vowel(char c){
return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}

int is_h_consonant(char c){
return c == 'H' || c == 'h' || c == 'K' || c == 'k' || c == 'L' || c == 'l' || c == 'M' || c == 'm' || c == 'N' || c == 'n' || c == 'P' || c == 'p' || c == 'W' || c == 'w';
}

LETTERS.H

int is_vowel(char);
int is_h_consonant(char);

DRIVER1.C

#include
#include"letters.h"

int main()
{
while(1)
{
int input;
//Asks the user to enter 1 or 2 to see if the letter is a consonant
//of vowel.
printf("Enter 1 to check vowel or 2 for consonant:");
//scans inputted number
scanf("%i", &input);
//if the input is 1 then it will ask the user to enter the letter
//they want to test.
if(input == 1)
{
char c;
printf("Enter a character to test if it's a vowel:");
c = getchar();
//if it is a vowel, then it will print that the letter is a vowel
if(is_vowel(c))
{
printf("%c is a vowel.\n", c);
}
//if not, then it will print that it isn't a vowel
else
{
printf("%c is not a vowel.\n", c);
}
}
{
//if the user inputs 2, then it will ask the user for the letter to test if
//it's a consonant or not.

if(input == 2)
{
char c;
printf("Enter a character to test if it's a consonant:");
c = getchar();
//if it is a consonant, then it will print that the letter is a consonant
if(is_h_consonant(c))
{
printf("%c is a consonant.\n", c);
}
//if not, then it will tell the user that it isn't a consonant
else{
printf("%c is not a consonant.\n", c);
}
}
else{
break;
}
}
}

return 0;
}

THIS IS WHAT I GET AS A SAMPLE OUTPUT:

Enter 1 to check vowel or 2 for consonant:2
Enter a character to test if it's a consonant:
is not a consonant.
Enter 1 to check vowel or 2 for consonant:1
Enter a character to test if it's a vowel:
is not a vowel.

Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
4 0

Answer:

see explaination

Explanation:

Code below:

#include"letters.h"

int main()

{

while(1)

{

int input;

//Asks the user to enter 1 or 2 to see if the letter is a consonant

//of vowel.

printf("Enter 1 to check vowel or 2 for consonant:");

//scans inputted number

scanf("%i", &input);

//if the input is 1 then it will ask the user to enter the letter

//they want to test.

if(input == 1)

{

char c;

printf("Enter a character to test if it's a vowel:");

scanf(" %c",&c);

//if it is a vowel, then it will print that the letter is a vowel

if(is_vowel(c))

{

printf("%c is a vowel.\n", c);

}

//if not, then it will print that it isn't a vowel

else

{

printf("%c is not a vowel.\n", c);

}

}

//if the user inputs 2, then it will ask the user for the letter to test if

//it's a consonant or not.

else if(input == 2)

{

char c;

printf("Enter a character to test if it's a consonant:");

scanf(" %c",&c);

//if it is a consonant, then it will print that the letter is a consonant

if(is_h_consonant(c))

{

printf("%c is a consonant.\n", c);

}

//if not, then it will tell the user that it isn't a consonant

else{

printf("%c is not a consonant.\n", c);

}

}

else{

break;

}

}

return 0;

}

See attachment for sample output

You might be interested in
100 POINTS!!!!
Alisiya [41]

Answer:

☆<em>intellectual property</em>☆

<u>intangible </u><u>a</u><u>s</u><u>s</u><u>e</u><u>t</u><u>s</u><u> </u><u> that result from intellectual</u><u> </u><u>p</u><u>r</u><u>o</u><u>p</u><u>e</u><u>r</u><u>t</u><u>y</u><u> </u><u>.</u>

<u>☆</u><u>I</u><u>n</u><u>t</u><u>a</u><u>n</u><u>g</u><u>i</u><u>b</u><u>l</u><u>e</u><u>☆</u><u>;</u>

<u>s</u><u>o</u><u>m</u><u>e</u><u>t</u><u>h</u><u>i</u><u>n</u><u>g</u><u> </u><u>t</u><u>h</u><u>a</u><u>t</u><u> </u><u>c</u><u>a</u><u>n</u><u>n</u><u>o</u><u>t</u><u> </u><u>b</u><u>e</u><u> </u><u>t</u><u>o</u><u>u</u><u>c</u><u>h</u><u>e</u><u>d</u><u>.</u>

<em>P</em><em>l</em><em>e</em><em>a</em><em>s</em><em>e</em><em> </em><em>M</em><em>a</em><em>r</em><em>k</em><em>☆</em>

<em>A</em><em>r</em><em>i</em><em>a</em><em>♡</em>

5 0
3 years ago
Which key should you press to change the cell contents to your typed data ? ​
Andreyy89

Answer:

You should press the Enter key to change the cell contents to your typed data.

Explanation:

4 0
3 years ago
Write a program named Deviations.java that creates an array with the deviations from average of another array. The main() method
Westkost [7]

Answer:

hello your question is incomplete attached is the complete question and solution

answer : The solution is attached below

Explanation:

Below is a program named Derivations.java that creates an array with the deviations from average of another array.

3 0
4 years ago
Inputs to a system that can enhance performance is called
disa [49]
Inputs to a system that can enhance performance is called Resources
6 0
3 years ago
Read 2 more answers
Que relacion tiene Las palabras: fermentacion-vino y clonacion- dolly​
rjkz [21]

Answer:

Al final, la hembra adulta da a luz a un animal que tiene la misma composición genética que el animal que donó la célula somática. A esta cría se le conoce como clon. La clonación reproductiva podría requerir el uso de una madre sustituta para hacer posible el desarrollo del embrión clonado, tal como fue el caso del más famoso.

Explanation:

4 0
3 years ago
Other questions:
  • What type of devices are a keyboard and a mouse?
    7·1 answer
  • What does a code of conduct include.
    10·2 answers
  • Write a program named convertdate that converts a date entered by the user into another form. the user's input will have the for
    8·1 answer
  • Select the correct answer. Steve wants to change shooting and exposure settings while on his photo shoot. Which camera part will
    7·2 answers
  • A bagel shop has two locations, one campus location and one downtown location. A random sample of 40 customers at the campus loc
    13·1 answer
  • What are two critical properties for a cryptographic hash function?
    9·1 answer
  • You need to write a class called SingleItemBox (in a file called SingleItemBox.java that you create). This class has a construct
    6·1 answer
  • Intel Centrino Technology is the combinatin of wirelesstechnology with the previous HT technology.
    14·1 answer
  • At the beginning of Section 5.2, it is stated that multiprogramming and multiprocessing present the same problems, with respect
    8·1 answer
  • Develop an algorithm to print the names of the candidates who should receive a refund. A refund is due if the candidate's votes
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!