Question
public class Report { //instance variables int roll; //store roll number String name; //store name double sub1; //store marks of subject 1 double sub2; //store
public class Report { //instance variables int roll; //store roll number String name; //store name double sub1; //store marks of subject 1 double sub2; //store marks of subject 2 double sub3; //store marks of subject 3 double sub4; //store marks of subject 4 double total; //store total marks double percent; //store percentage char grade; //store grade public Report(int roll, String name, double sub1, double sub2, double sub3, double sub4) { //parameterized constructor //setting the values this.roll = roll; this.name = name; this.sub1 = sub1; this.sub2 = sub2; this.sub3 = sub3; this.sub4 = sub4; total=0; percent=0; grade=' '; } public int getRoll() { //getter for roll number return roll; } public void setRoll(int roll) { //setter for roll number this.roll = roll; } public String getName() { //getter for name return name; } public void setName(String name) { //setter for name this.name = name; } public double getSub1() { //getter for subject 1 return sub1; } public void setSub1(double sub1) { //setter for subject 1 this.sub1 = sub1; } public double getSub2() { //getter for subject 2 return sub2; } public void setSub2(double sub2) { //setter for subject 2 this.sub2 = sub2; } public double getSub3() { //getter for subject 3 return sub3; } public void setSub3(double sub3) { //setter for subject 3 this.sub3 = sub3; } public double getSub4() { //setter for subject 4 return sub4; } public void setSub4(double sub4) { //setter for subject 4 this.sub4 = sub4; } public char getGrade() { //getter for grade return grade; } public void setGrade(char grade) { //setter for grade this.grade = grade; } public double calcTotal() { //function returns total marks this.total=sub1+sub2+sub3+sub4; //calculate return total; } public double calcPercent() { //function returns total percentage this.percent=(total/400)*100; //calculate percentage return percent; //return } @Override public String toString() { //print details return "" + roll + "\t" + name + "\t" + sub1 + "\t\t" + sub2 + "\t\t" + sub3 + "\t\t" + sub4 + "\t\t" + total + "\t" + percent + "%\t\t"+grade+""; } } ReportCard.java import java.util.*; public class ReportCard { public static void main(String[] args) { Scanner sc=new Scanner(System.in); //scanner //creating arraylist of Report ArrayList
Explanation
Please refer to solution in this step.
AM code
%>>>>>>>>>>>>>>>>>>>> Tuterial on AM Modulation <<<<<<<<<<<<<<<<<<<<<<<<<< clc; close all; clear all;
%XXXXXXXXXXXXXXXXXXXXXXXXXXX Define AM modulation Index XXXXXXXXXXXXXXXXXXX disp(' example: m=1 means 100% modulation'); %m=input(' Enter the value of modulation index (m) = '); m=1 ; % for 100% modulation if ( 0>m || m>1 ) error('m may be less than or equal to one and geter than to zero'); end % hello Comm Sys class % XXXXXXXXXXXXXXXXX modulating signal generation m(t) XXXXXXXXXXXXXXXXXXXXXXXXXX Am=5; % Amplitude of modulating signal fa=2000; % Frequency of modulating signal Ta=1/fa; % Time period of modulating signal t= 0: Ta/999 : 6*Ta; % Total time for simulation ym=Am*cos(2*pi*fa*t); % m(t) Eqation of modulating signal figure(1) subplot(3,1,1); plot(t,ym), grid on;% Graphical representation of Modulating signal title ( ' Modulating Signal '); xlabel ( ' time(sec) '); ylabel (' Amplitud(volt) ');
%XXXXXXXXXXXXXXXXXXXXX carrier signal generation c(t) XXXXXXXXXXXXXXXXXXXXXXXXXX Ac=Am/m;% Amplitude of carrier signal [ where, modulation Index (m)=Am/Ac ] fc=fa*10;% Frequency of carrier signal Tc=1/fc;% Time period of carrier signal yc=Ac*cos(2*pi*fc*t);% Eqation of carrier signal subplot(3,1,2); plot(t,yc), grid on;% Graphical representation of carrier signal title ( ' Carrier Signal '); xlabel ( ' time(sec) '); ylabel (' Amplitud(volt) ');
%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX AM Modulation S(t) XXXXXXXXXXXXXXXXXXXXXXXXXXX y=Ac * ( 1 + m*cos(2*pi*fa*t) ) .* cos(2*pi*fc*t); % Equation of Amplitude %modulated signal subplot(3,1,3); plot(t,y);% Graphical representation of AM signal title ( ' Amplitude Modulated signal '); xlabel ( ' time(sec) '); ylabel (' Amplitud(volt) '); grid on; %>>>>>>>>>>>>>>>>>>>>>> end of program <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started