Advertisement
ZinedinZidan

Java

Jun 18th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.74 KB | None | 0 0
  1. Write a program to print the roll number and average marks of 8 students in three subjects (each out of 100). The marks are entered by user.
  2. Write a program to print the roll number and average marks of 8 students in three subjects (each out of 100). The marks are entered by user.
  3.  
  4.  
  5.  
  6.  
  7.  
  8. //print the roll number and average marks of 8 students in three subject(search out of 100). The marks are entered by user.
  9.  
  10. package oopjava;
  11.  
  12.  
  13.  
  14. import java.util.Scanner;
  15.  
  16.  
  17.  
  18. public class task2oopweek1 {
  19.  
  20.     public static void main(String[] args) {
  21.  
  22.         for (int i = 1; i <=8; i++) {
  23.  
  24.             Scanner input = new Scanner(System.in);
  25.  
  26.             System.out.println("Put roll number for no."+i+" student:");
  27.  
  28.             int roll = input.nextInt();
  29.  
  30.             System.out.println("Your roll is: "+roll);
  31.  
  32.            
  33.  
  34.             System.out.println("Enter math marks: ");
  35.  
  36.             double math= input.nextDouble();
  37.  
  38.             System.out.println("Enter EEE marks: ");
  39.  
  40.             double EEE= input.nextDouble();
  41.  
  42.             System.out.println("Enter English marks: ");
  43.  
  44.             double English= input.nextDouble();
  45.  
  46.            
  47.  
  48.             double average = (math+ EEE + English)/3;
  49.  
  50.            
  51.  
  52.             System.out.println("The average of three subjects is: "+average);
  53.  
  54.         }
  55.  
  56.     }
  57.  
  58.    //id:192-15-2820
  59.  
  60. }
  61.  
  62.  
  63.  
  64.  
  65. package classwork;
  66.  
  67. import java.util.Scanner;
  68.  
  69. public class MarkEntrySytem {
  70.  
  71.     public static void main(String[] args) {        
  72.  
  73.         int r,m1,m2,m3;
  74.  
  75.         Scanner input=new Scanner(System.in);
  76.  
  77.        
  78.  
  79.         System.out.print("Enter Roll Number:");
  80.  
  81.         r=input.nextInt();
  82.  
  83.        
  84.  
  85.         System.out.print("Enter Marks of Subject1:");
  86.  
  87.         m1=input.nextInt();
  88.  
  89.         System.out.print("Enter Marks of Subject2:");
  90.  
  91.         m2=input.nextInt();
  92.  
  93.         System.out.print("Enter Marks of Subject3:");
  94.  
  95.         m3=input.nextInt();
  96.  
  97.        
  98.  
  99.         double a=(m1+m2+m3)/3;
  100.  
  101.         System.out.printf("Average Marks of Roll %d is: %.2f\n",r,a);      
  102.  
  103.     }    
  104.  
  105. }
  106.  
  107.  
  108.  
  109.  
  110. zafrin all mustary
  111.  
  112. 192-15-2834
  113.  
  114. package oop;
  115.  
  116.  
  117.  
  118. import java.util.Scanner;
  119.  
  120. import java.text.DecimalFormat;
  121.  
  122.  
  123.  
  124. public class student_marks {
  125.  
  126.     public static void main(String[] args) {
  127.  
  128.         Scanner input= new Scanner(System.in);
  129.  
  130.         DecimalFormat df2 = new DecimalFormat(".000");
  131.  
  132.         double  math,bangla,english;
  133.  
  134.         double avg;
  135.  
  136.         for (int i = 0; i < 8; i++) {
  137.  
  138.             System.out.print("enter student id:");
  139.  
  140.             int id= input.nextInt();
  141.  
  142.             System.out.println("student id is:"+id);
  143.  
  144.             System.out.print("enter marks for math:");
  145.  
  146.             math= input.nextInt();
  147.  
  148.             System.out.print("enter mark of bangla:");
  149.  
  150.             bangla= input.nextInt();
  151.  
  152.             System.out.print("enter mark of english:");
  153.  
  154.             english= input.nextInt();
  155.  
  156.             avg= (math+bangla+english)/3;
  157.  
  158.             System.out.println("student id number:"+id+"got average number:"+df2.format(avg));
  159.  
  160.            
  161.  
  162.            
  163.  
  164.                    
  165.  
  166.            
  167.  
  168.         }
  169.  
  170.     }
  171.  
  172.    
  173.  
  174. }
  175.  
  176.  
  177.  
  178.  
  179. //Tawhid Ahmed Komol
  180.  
  181. //Id: 192-15-2861
  182.  
  183. //Program to print the roll number and average marks of 8 students in three subjects (each out of 100). The marks are entered by user.
  184.  
  185.  
  186.  
  187. package oop;
  188.  
  189. import java.util.Scanner;
  190.  
  191. import java.text.DecimalFormat;
  192.  
  193. public class Result {
  194.  
  195.        public static void main(String[] args) {
  196.  
  197.         Scanner input=new Scanner(System.in);
  198.  
  199.         DecimalFormat df2 = new DecimalFormat(".00");
  200.  
  201.         double math, phy, eng;  
  202.  
  203.         for (int i=0; i < 8; i++) {
  204.  
  205.             System.out.print("Enter student Id: ");
  206.  
  207.             int id=input.nextInt();
  208.  
  209.             System.out.println("Student Id is: "+id);
  210.  
  211.             System.out.print("Enter Marks for Math: ");
  212.  
  213.             math=input.nextInt();
  214.  
  215.             System.out.print("Enter Marks for Physics: ");
  216.  
  217.             phy=input.nextInt();
  218.  
  219.             System.out.print("Enter Marks for English: ");
  220.  
  221.             eng=input.nextInt();
  222.  
  223.             double avg=((math+phy+eng)/3);
  224.  
  225.             System.out.println("Student Id no "+id+" got Average: "+df2.format(avg)+" marks in 3 subject");      
  226.  
  227.         }        
  228.  
  229.     }    
  230.  
  231. }
  232.  
  233.  
  234. //Write a program to print the roll number and average marks of 8 students in three subjects (each out of 100). The marks are entered by user.
  235.  
  236. package practice_problem;
  237.  
  238. import java.util.Scanner;
  239.  
  240. public class StudentMarks {
  241.  
  242.     public static void main(String[] args) {
  243.  
  244.         int roll,marks,sum=0;
  245.  
  246.         Scanner input = new Scanner(System.in);
  247.  
  248.         for (int i = 1; i <= 8; i++) {
  249.  
  250.             System.out.printf("Enter Roll Number = ");
  251.  
  252.             roll=input.nextInt();
  253.  
  254.             for (int j = 1; j <= 3; j++) {
  255.  
  256.                 System.out.printf("Enter Marks of Subject[%d] : ",j);
  257.  
  258.                 marks = input.nextInt();
  259.  
  260.                 sum = sum + marks;
  261.  
  262.             }
  263.  
  264.             System.out.println("");
  265.  
  266.             double average = (double)sum/3;
  267.  
  268.             System.out.println ("The Roll Number of Student "+": "+roll);
  269.  
  270.             System.out.println("Average Marks : "+average);
  271.  
  272.             System.out.println("");
  273.  
  274.         }
  275.  
  276.     }
  277.  
  278. }
  279.  
  280.  
  281.  
  282.  
  283. package exercise01;
  284.  
  285.  
  286.  
  287. import java.util.Scanner;
  288.  
  289.  
  290.  
  291.  
  292.  
  293. public class NewClass3 {
  294.  
  295.    
  296.  
  297.     public static void main(String[] args) {
  298.  
  299.        
  300.  
  301.         Scanner input = new Scanner(System.in);
  302.  
  303.        
  304.  
  305.         int roll, s1,s2,s3;
  306.  
  307.        
  308.  
  309.         System.out.print("enter roll 1number: ");
  310.  
  311.         roll= input.nextInt();
  312.  
  313.        
  314.  
  315.         System.out.print("number of subject one: ");
  316.  
  317.         s1=input.nextInt();
  318.  
  319.         System.out.print("number of subject two: ");
  320.  
  321.         s2=input.nextInt();
  322.  
  323.         System.out.print("number of subject three: ");
  324.  
  325.         s3=input.nextInt();
  326.  
  327.        
  328.  
  329.         double result= (s1+s2+s3)/3;
  330.  
  331.         System.out.printf("Avarage marks: %.2f/n",result);
  332.  
  333.     }
  334.  
  335. }
  336.  
  337.  
  338.  
  339.  
  340. package ooptask;
  341.  
  342.  
  343.  
  344. import java.util.Scanner;
  345.  
  346.  
  347.  
  348.  
  349.  
  350. public class OopWeek1Task3 {
  351.  
  352.     public static void main(String[] args) {
  353.  
  354.         int i,j,roll_number,marks,sum=0;
  355.  
  356. double average;
  357.  
  358.  Scanner s = new Scanner(System.in);
  359.  
  360.  for(i=1;i<=8;i++){
  361.  
  362.      System.out.println("Enter roll_number: ");
  363.  
  364.      roll_number = s.nextInt();
  365.  
  366.      for(j=1;j<=3;j++){
  367.  
  368.          System.out.printf("enter marks of subject:%d",j);
  369.  
  370.          marks = s.nextInt();
  371.  
  372.          sum = sum+marks;
  373.  
  374.      }
  375.  
  376.      System.out.println("");
  377.  
  378.      average =(double)sum/3;
  379.  
  380.      System.out.println("The roll_number of a student"+""+roll_number);
  381.  
  382.      System.out.println("Average Marks: "+average);
  383.  
  384.      System.out.println("");
  385.  
  386.  }
  387.  
  388.     }
  389.  
  390. }
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399. package jhavagun;
  400.  
  401. import java.util.Scanner;
  402.  
  403. public class Result {
  404.  
  405.     public static void main(String[] args) {
  406.  
  407.        int i=1;
  408.  
  409.        while(i<9){
  410.  
  411.         Scanner input=new Scanner(System.in);
  412.  
  413.         System.out.println(" Student number "+i);
  414.  
  415.         System.out.print("Enter your Roll Number : ");
  416.  
  417.         String a=input.nextLine();
  418.  
  419.         double b;
  420.  
  421.         System.out.print("Enter Your Bangla Exam Number : ");
  422.  
  423.         b=input.nextDouble();
  424.  
  425.         double c;
  426.  
  427.         System.out.print("Enter Your English Exam Number : ");
  428.  
  429.         c=input.nextDouble();
  430.  
  431.         double d;
  432.  
  433.         System.out.print("Enter Your Math Exam Number : ");
  434.  
  435.         d=input.nextDouble();
  436.  
  437.         double e=(b+c+d)/3;
  438.  
  439.         System.out.println("Your id is : "+a);
  440.  
  441.         System.out.println("Your number avgerage : "+e);
  442.  
  443.         i++;
  444.  
  445.        }
  446.  
  447.        
  448.  
  449.     }
  450.  
  451. }
  452.  
  453.  
  454.  
  455.    
  456.  
  457.  
  458.  
  459.    
  460.  
  461.  
  462.  
  463.  
  464. package oop;
  465.  
  466.  
  467.  
  468. import java.util.Scanner;
  469.  
  470.  
  471.  
  472. public class Student_Information {
  473.  
  474.    
  475.  
  476.     public static void main(String[] args) {
  477.  
  478.        
  479.  
  480.     int rollNumber,marks,result=0;
  481.  
  482.     double average;
  483.  
  484.     Scanner input = new Scanner(System.in);
  485.  
  486.    
  487.  
  488.    
  489.  
  490.         for (int i = 1; i < 9; i++) {
  491.  
  492.             System.out.println("Enter The Roll Number :");
  493.  
  494.             rollNumber = input.nextInt();
  495.  
  496.            
  497.  
  498.             for (int j = 1; j < 4; j++) {
  499.  
  500.                
  501.  
  502.                 System.out.println("Enter The Marks Of Subjects :");
  503.  
  504.                
  505.  
  506.                 marks = input.nextInt();
  507.  
  508.                
  509.  
  510.                 result = result+marks;
  511.  
  512.                
  513.  
  514.             }
  515.  
  516.            average = result/3;
  517.  
  518.            
  519.  
  520.             System.out.println("The roll number :"+rollNumber);
  521.  
  522.            
  523.  
  524.             System.out.println("Average Marks (each out of 100):"+average);
  525.  
  526.            
  527.  
  528.         }
  529.  
  530.            
  531.  
  532.         }
  533.  
  534.        
  535.  
  536.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement