Summary

This document contains class notes for a practical file in information technology. It includes examples of programs for calculating percentages, storing textual data, and using a switch statement to find the day of the week.

Full Transcript

Class Notes Class: XII Topic: Practical File Subject: Information Technology (802) Term-II 1. Write a program to calculate percentage calculator program, using three variables named marks_obtained, total_marks and per...

Class Notes Class: XII Topic: Practical File Subject: Information Technology (802) Term-II 1. Write a program to calculate percentage calculator program, using three variables named marks_obtained, total_marks and percentage. int total_marks = 400; double marks_obtained = 346; double percentage = 0.0; percentage = (marks_obtained/total_marks)*100; System.out.println("Student 1's Percentage = "+percentage); marks_obtained = 144; percentage = (marks_obtained/total_marks)*100; System.out.println("Student 2's Percentage = "+percentage); 2. Write a program to store textual data, for example, the name of a student Mayank M Saxena). char middle_name = 'M'; String first_name = "Mayank"; String last_name = "Saxena"; System.out.println(first_name+" "+ middle_name+" "+last_name); 3. Write a program to demonstrates usage of the switch statement for finding week day. public static void main (String[ ] args) { int today = 5; String day = ""; switch (today) { case 1: day = "Monday"; break; case 2: day = "Tuesday"; break; case 3: day = "Wednesday"; break; case 4: day = "Thursday"; break; case 5: day = "Friday"; break; case 6: day = "Saturday"; break; case 7: day = "Sunday"; break; default: day = "Incorrect Day!"; break; } System.out.println (day);} 4. WAP to display the values from 1 to 5 using FOR loop int i; for (i=1; i

Use Quizgecko on...
Browser
Browser