Java Program
Suppose a student was taking 5 different courses last semester. Write a program that
(a) asks the student to input his/her name, student ID, marks for these 5 courses,
(b) calculate the average,
(c) determine the letter grade of each course.
(d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-.
(e) Output the following information in a nice format: student name, student ID, listing of marks, the average, letter grade for each course, and the number of courses in each letter grade category.
I dont know how to do part ( d )
here is my code:
import java.util.Scanner;
public class Question_2 {
public String Grade(int mark) {
String GradeLetter = "";
if (mark >= 93 && mark <= 100)
GradeLetter = "A+";
if (mark >= 86 && mark < 93)
GradeLetter = "A";
if (mark >= 80 && mark < 86)
GradeLetter = "A-";
if (mark >= 77 && mark < 80)
GradeLetter = "B+";
if (mark >= 73 && mark < 77)
GradeLetter = "B";
if (mark >= 70 && mark < 73)
GradeLetter = "B-";
if (mark >= 67 && mark < 70)
GradeLetter = "C+";
if (mark >= 63 && mark < 67)
GradeLetter = "C";
if (mark >= 60 && mark < 63)
GradeLetter = "C-";
if (mark >= 57 && mark < 60)
GradeLetter = "D+";
if (mark >= 53 && mark < 57)
GradeLetter = "D";
if (mark >= 50 && mark < 53)
GradeLetter = "D-";
if (mark >= 35 && mark < 50)
GradeLetter = "F";
if (mark >= 0 && mark < 35)
GradeLetter = "F-";
return GradeLetter;
}
public static void main(String[] args) {
Question_2 q2 = new Question_2();
// declare variables
String name;// student name
int studentID;// student ID
int mark1, mark2, mark3, mark4, mark5;// student marks in each 5 courses
// asks the student to input his/her name
System.out.println("Input your first name: ");
Scanner input = new Scanner(System.in);
name = input.nextLine();
// asks the student to input student ID
System.out.println("Input your StudentID (integer in 5 digits),ex:000000 :");
studentID = input.nextInt();
// asks the student to input marks of 5 different courses last semester
System.out.println("Input your courses grade (0-100)integer number ");
System.out.println("Your course1's grade: ");
mark1 = input.nextInt();
System.out.println("Your course2's grade: ");
mark2 = input.nextInt();
System.out.println("Your course3's grade: ");
mark3 = input.nextInt();
System.out.println("Your course4's grade: ");
mark4 = input.nextInt();
System.out.println("Your course5's grade: ");
mark5 = input.nextInt();
// Calculate the average of 5 different courses last semester
double average = (mark1 + mark2 + mark3 + mark4 + mark5) / 5.0;
/*
* Output the following information in a nice format: student name,
* student ID, listing of marks, the average, letter grade for each
* course, and the number of courses in each letter grade category.
*/
System.out.println("**********************************************");
System.out.println("Student Name: " + name);
System.out.println("Student ID : " + studentID);
System.out.println(name + " grade in " + "Course1: " + mark1 + " " + q2.Grade(mark1));
System.out.println(name + " grade in " + "Course2: " + mark2 + " " + q2.Grade(mark2));
System.out.println(name + " grade in " + "Course3: " + mark3 + " " + q2.Grade(mark3));
System.out.println(name + " grade in " + "Course4: " + mark4 + " " + q2.Grade(mark4));
System.out.println(name + " grade in " + "Course5: " + mark5 + " " + q2.Grade(mark5));
System.out.println(name + " avaerage grade is: " + average);
System.out.println("**********************************************");
}
}
In: Computer Science
Java Program
Suppose a student was taking 5 different courses last semester. Write a program that
(a) asks the student to input his/her name, student ID, marks for these 5 courses,
(b) calculate the average,
(c) determine the letter grade of each course.
(d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-.
(e) Output the following information in a nice format: student name, student ID, listing of marks, the average, letter grade for each course, and the number of courses in each letter grade category.
I dont know how to do d
here is my code:
import java.util.Scanner;
public class Question_2 {
public String Grade(int mark) {
String GradeLetter = "";
if (mark >= 93 && mark <= 100)
GradeLetter = "A+";
if (mark >= 86 && mark < 93)
GradeLetter = "A";
if (mark >= 80 && mark < 86)
GradeLetter = "A-";
if (mark >= 77 && mark < 80)
GradeLetter = "B+";
if (mark >= 73 && mark < 77)
GradeLetter = "B";
if (mark >= 70 && mark < 73)
GradeLetter = "B-";
if (mark >= 67 && mark < 70)
GradeLetter = "C+";
if (mark >= 63 && mark < 67)
GradeLetter = "C";
if (mark >= 60 && mark < 63)
GradeLetter = "C-";
if (mark >= 57 && mark < 60)
GradeLetter = "D+";
if (mark >= 53 && mark < 57)
GradeLetter = "D";
if (mark >= 50 && mark < 53)
GradeLetter = "D-";
if (mark >= 35 && mark < 50)
GradeLetter = "F";
if (mark >= 0 && mark < 35)
GradeLetter = "F-";
return GradeLetter;
}
public static void main(String[] args) {
Question_2 q2 = new Question_2();
// declare variables
String name;// student name
int studentID;// student ID
int mark1, mark2, mark3, mark4, mark5;// student marks in each 5 courses
// asks the student to input his/her name
System.out.println("Input your first name: ");
Scanner input = new Scanner(System.in);
name = input.nextLine();
// asks the student to input student ID
System.out.println("Input your StudentID (integer in 5 digits),ex:000000 :");
studentID = input.nextInt();
// asks the student to input marks of 5 different courses last semester
System.out.println("Input your courses grade (0-100)integer number ");
System.out.println("Your course1's grade: ");
mark1 = input.nextInt();
System.out.println("Your course2's grade: ");
mark2 = input.nextInt();
System.out.println("Your course3's grade: ");
mark3 = input.nextInt();
System.out.println("Your course4's grade: ");
mark4 = input.nextInt();
System.out.println("Your course5's grade: ");
mark5 = input.nextInt();
// Calculate the average of 5 different courses last semester
double average = (mark1 + mark2 + mark3 + mark4 + mark5) / 5.0;
/*
* Output the following information in a nice format: student name,
* student ID, listing of marks, the average, letter grade for each
* course, and the number of courses in each letter grade category.
*/
System.out.println("**********************************************");
System.out.println("Student Name: " + name);
System.out.println("Student ID : " + studentID);
System.out.println(name + " grade in " + "Course1: " + mark1 + " " + q2.Grade(mark1));
System.out.println(name + " grade in " + "Course2: " + mark2 + " " + q2.Grade(mark2));
System.out.println(name + " grade in " + "Course3: " + mark3 + " " + q2.Grade(mark3));
System.out.println(name + " grade in " + "Course4: " + mark4 + " " + q2.Grade(mark4));
System.out.println(name + " grade in " + "Course5: " + mark5 + " " + q2.Grade(mark5));
System.out.println(name + " avaerage grade is: " + average);
System.out.println("**********************************************");
}
}
In: Computer Science
Write code to read a list of song names and durations from input. Input first receives a song name, then the duration of that song. Input example: Time 424 Money 383 quit.
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Song {
public:
void SetNameAndDuration(string songName, int songDuration) {
name = songName;
duration = songDuration;
}
void PrintSong() const {
cout << name << " - " << duration <<
endl;
}
string GetName() const { return name; }
int GetDuration() const { return duration; }
private:
string name;
int duration;
};
int main() {
vector<Song> songPlaylist;
Song currentSong;
string currentName;
int currentDuration;
unsigned int i;
cin >> currentName;
while (currentName != "quit") {
/* Your code goes here */
}
for (i = 0; i < songPlaylist.size(); ++i) {
currentSong = songPlaylist.at(i);
currentSong.PrintSong();
}
return 0;
}
In: Computer Science
We have a class defined for vehicles. Create two new vehicles called car1 and car2. Let car1 to be a red convertible worth $60,000.00 with a name of Fer, and car2 to be a blue van named Jump worth $10,000.00.
# define the Vehicle class
class Vehicle:
name = ""
kind = "car"
color = ""
value = 100.00
def description(self):
print (“Name of car =”,self.name)
print (“Kind of car =”,self.kind)
print (“Color of car =”,self.color)
print (“Value of car =”,self.value)
# test code
car1.description()
car2.description()
Using the program above, add in your own codes in order to complete the program to produce the output as below:
Name of car = Fer
Kind of car = Convertible
Color of car = Red
Value of car = $60,000
Name of car = Jump
Kind of car = Van
Color of car = Blue
Value of car = $10,000
#Python
In: Computer Science
For the following commands you must be logged in as user “system”. You will need to do some research on the commands CREATE USER; GRANT CREATE SESSION; GRANT CREATE…..; GRANT ALTER …., GRANT SELECT….; REVOKE ……; and EXECUTE …..
5. Create two database users: The first is a concatenation of your first and last name (e.g. johndoe). The second is a concatenation of your instructors first and last name (e.g. sallysmith)
6. Assign the two users privileges to connect to the database.
7. Assign the user with your first and last name the privilege to select data from the employees table.
8. Assign the user with your instructors first and last name all privileges to the Departments table.
9. Assign the user with your first and last name the privilege to execute any procedure.
10. Take away the instructors privilege to execute any SQL commands on the Departments table
In: Computer Science
1. Dictionaries and Lists.
a) Implement a list of student dictionaries containing the following data:
name: Andy, classes: ET580 MA471 ET574
name: Tim, classes: ET574 MA441 ET575
name: Diane, classes: MA441 MA471 ET574
name: Lucy, classes: ET574 ET575 MA471
name: Steven, classes: ET574 MA441 ET580
b) Implement a dictionary of courses and set each courses enrollment to 0: ET580: 0 ET574: 0 ET575: 0 MA441: 0 MA471: 0
c) Use a loop and if statements to read class data from the list of students and update the enrollment for each course.
d) Print the updated list of courses. If the above steps are done correctly your output should match the output example.
Output Example
ET580 2 ET575 2 ET574 5 MA441 3 MA471 3
In: Computer Science
Exercise: Add Monster Cast Member
-------------------------
### Description
In this series of exercises, you will create functions
to create, modify and examine dictionaries that
represent characters in an animated film, and the
cast members who voice the characters. The
keys of the dictionary will be character names.
The values in the dictionary will be voice actor
names.
For this exercise, you will create a function that
adds an entry to a dictionary. They key is a
character name, and the value is the name of the
voice actor.
### Files
* `monsterfunctions.py` : set of functions to work with monster cast dictionaries.
### Function Name
`add_cast_member`
### Parameters
* `monsters`: a dictionary
* `character`: a string, the name of a character
* `cast_member`: a string, the name of an actor
### Action
Adds an entry to `monsters`, using `character` as the
key and `cast_member` as the value.
### Return Value
The modified dictionary.
def create_monster_cast():
d1={}
return d1
def add_cast_member(monsters, character, cast_member):
dict = {
"monsters":monsters,
"character":character,
"cast_member":cast_member
}
return dict
In: Computer Science
Library Management System allows the user to borrow and return the books. The book is identified by book name, accession number, item category, due date, due time, and status. Before the user proceeds to borrow or return the books, they need to register for an account. Each user can have only one account. The user can be a staff or student. Each user is identified by ID number, name, school/department name, address. The books are arranged on a shelf. The shelf can be of two categories: open shelf or red spot. The user is allowed to reserve the book, in case, if the book is already borrowed by someone. While reserving a book, the user needs to specify the user name, ID number, book name, and accession number.
##Based on the above scenario, draw a Class Diagram. Your diagram should include attributes, methods and multiplicity.
In: Computer Science
A system is set up to take raw grading information from the console and calculate a consolidated grade. The information comes in as a single line with last name, first name, homework grade ( a total out of 20 ), lab grade ( a total out of 50 ), exam grade average, and a letter ( upper or lower ) indicating Audit, Passfail, or Grade.
Sample input: Mary(first name) Poppins(last name) g(indication) 17(homework grade) 28(lab grade) 87(exam grade)
A program should be written that takes the input data and calculates a consolidated grade based upon 10% Homework, 20 % Lab , and 70% Exams. The output should be formatted with no decimals.
first initial last name - final grade
for a pass/fail student output should indicate only Pass or Fail . For an audit output should say not gradeable.
Using C++
In: Computer Science
Your client, Wholesaler, sold a large number of freezers to Retailer on credit. This occurred on May 1, 2017. Wholesaler had purchased these freezers from Manufacturer on March 1, 2017. Manufacturer had purchased the components from Supplier on November 1, 2016. Assume that each transaction is a credit sale and that every creditor timely filed a UCC-1 such that they are secured parties.
A. Now assume that Cindy bought a freezer for her house from Retailer on May 15, 2017. Retailer filed the UCC-1 on July 1, 2017. Cindy sold that freezer to her friend, Cool Girl, on January 5, 2018. Cool Girl was paying Retailer for the debt in Cindy’s name until Cool Girl lost her job on March 1, 2018. Cool Girl has not made a payment since but he has not told Cindy about this either. What are Retailer’s rights as to this freezer? Would that change if Retailer did not file a UCC-1? Why or why not?
B. Assume that Supplier never filed when it sold to Manufacturer. Manufacturer files for Chapter 7 bankruptcy on January 5, 2017 and Manufacturer had not paid Supplier at that time. What are Supplier’s rights and remedies? What is the likely result for Supplier in this Chapter 7 bankruptcy since Supplier never filed?
In: Accounting