0% found this document useful (0 votes)
170 views

Module 3 - Computer-Programming-1

codes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views

Module 3 - Computer-Programming-1

codes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Weekly Module

2CC10

Computer
Programming
1

Name:
Course: Bachelor of Science in Information Technology

Instructor: Elizor M. Villanueva


MODULE 3 OF 7 |
| I CAN GIVE A TRY :
C

Using switch case, create a program that determines whether a user inputted character is a
vowel or consonant.

public class VowelConsonant {

public static void main(String[] args) {

char ch = 'a';

switch (ch) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
System.out.println(ch + " is vowel");
break;
default:
System.out.println(ch + " is consonant");
}
}
}

Covered under Copyright Law of the 2|Page


Philippines
2. Using if/else statement, write a program that will assign the value 50,000 to a variable.
The user will choose the mode of payment. The program will compute the total amount to be
paid according to mode of payment.

Mode of Payment Equivalent


Cash 5% discount
Quarterly 5% interest
Monthly 7% interest

Covered under Copyright Law of the 3|Page


Philippines
| I CAN GIVE A TRY :

Write a program that will print a diamond shape asterisk (*) on screen.
public class DiamondAsterisk {
public static void main(String[] args) {
int i,j,k;
for(i=1; i<=5; i++)
{
for(j=5; j>i; j--)
{
System.out.print(" ");
}
for(k=1; k<=(2*i-1);k++)
{
System.out.print("*");
}
System.out.print("\n");
}

//cutieeeee sakit sa ulo sir


for(i=4; i>=1; i--)
{
for(j=5; j>i; j--)
{
System.out.print(" ");
}
for(k=1; k<=(2*i-1);k++)
{
System.out.print("*");
}
System.out.print("\n");
}
}
}

Covered under Copyright Law of the 4|Page


Philippines
2) Write a program that will print the Fibonacci series form 0 to n. Where n is a
number value inputted by the user.

Covered under Copyright Law of the 5|Page


Philippines
| I CAN DO IT : PT03

You are working as Senior Programmer at McBee Food Corp and you were asked to write
an ordering program. The program accepts a user’s oder. The program will compute the
total cost of the order including the 12% VAT for non senior citizen/PWD then display
the receipt. The program ends when there’s no more orders to be made. Illustrate the flow
of your program using flowchart.

NOTE: Menu includes: 5 choises of DRINKS and 5 choices SNACKS.

Covered under Copyright Law of the 6|Page


Philippines
Covered under Copyright Law of the 7|Page
Philippines

You might also like