c++ class
Topics
Branches
if statement
if/else statement
Description
Write a program that will determine whether the user passed or failed a test. The program will ask the user to input the following:
Maximum Test Score - the maximum total scores in the test.
Percent Pass Score - the minimum percent scores required to pass the test.
User Test Score - the actual scores obtained by the user in the test.
From the above input values, the program will compute the user percent score. It will compare the percent user score with the percent pass score. If the percent user score is equal to or greater than the percent pass score, the program will consider the user having passed the test. Otherwise, the program will consider the user having failed the test. At the end, the program will display the result summary. See the Test section below.
Testing
Perform the test run 1 and the test run 2 below with the data shown below.
(User input is shown in bold.)
(It's OK if your decimal values don't look the same as below so long as they are equal)
Test Run 1
Enter Maximum Test Score:
400
Enter Percent Pass Score:
80
Enter User Test Score:
324
Result Summary
Test Result: Pass
User Test Score: 324
User Percent Score: 81.0 %
Maximum Score: 400
Percent Pass Score: 80.0 %
Test Run 2
Enter Maximum Test Score:
400
Enter Percent Pass Score:
80
Enter User Test Score:
316
Result Summary
Test Result: Fail
User Test Score: 316
User Percent Score: 79.0 %
Maximum Score: 400
Percent Pass Score: 80.0 %
Submit
Copy the following in a file and submit that file.
Output of test runs.
All the C/C++ source code.
Sample Code
// declare variables
double maxScore, pctPassScore, userScore, pctUserScore;
//write code to input maxScore, pctPassScore, userScore
//determine pctUserScore
pctUserScore = (userScore / maxScore) * 100.0
//determine test result
cout << "Result Summary" << endl << endl;
if (pctUserScore >= pctPassScore) {
cout << "Test Result: Pass" << endl;
}
else {
cout << "Test Result: Fail" << endl;
}
In: Computer Science
please answer each next to its question
Problem Description:
(The Account class) Design a class named Account that
contains:
A private int data field named id for the account (default
0).
A private double data field named balance for the account (default
0).
A private double data field named annualInterestRate that stores
the current interest rate (default 0). Assume all accounts have the
same interest rate.
A private Date data field named dateCreated that stores the date
when the account was created.
A no-arg constructor that creates a default account.
A constructor that creates an account with the specified id and
initial balance.
The accessor and mutator methods for id, balance, and
annualInterestRate.
The accessor method for dateCreated.
A method named getMonthlyInterestRate() that returns the monthly
interest rate.
A method named withdraw that withdraws a specified amount from the
account.
A method named deposit that deposits a specified amount to the
account.
Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and print the balance, the monthly interest, and the date when this account was created.
Analysis:
(Describe the problem including input and output in your own
words.)
Design:
(Draw an UML class diagram for the Account class.)
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
public class Test {
public static void main (String[] args) {
Account account = new Account(1122, 20000);
Account.setAnnualInterestRate(4.5);
account.withdraw(2500);
account.deposit(3000);
System.out.println("Balance is " + account.getBalance());
System.out.println("Monthly interest is " +
account.getMonthlyInterest());
System.out.println("This account was created at " +
account.getDateCreated());
}
}
Class Account {
// Implement the class here
}
Testing: (Describe how you test this program)
In: Computer Science
In: Computer Science
what is the concept of token bucket for traffic shaping , computer network, could anyone explain in detail, thanks
In: Computer Science
COMPUTER SCIENCES HOMEWORK
Assume it takes 10-6 seconds to do a unit of work.
| 10 | 100 | 1,000 | 10,000 | 100,000 | 1,000,000 | |
| n | ||||||
| n2 | ||||||
| log10(n) | ||||||
| 2n |
In each cell in this table put the length of time it would take to complete an algorithm with the given work formula and the given size.
Take the time to represent large numbers in reasonable values; eg. report 109 seconds as 25 hours
PLEASE HELP!!
In: Computer Science
Need the correct line of code for c program to solve this equation . i is a value that the program all ready calculates from user imput. t
i = (x*1000)+(y*500)+(z*250
In: Computer Science
Create a form in which the user enters two separate numbers (x and y), and when the user clicks the appropriate button, math functions are performed on these two numbers and output back on to the form.
INPUT
PROCESSING
OUTPUT
CRITERIA
GRADING
SUBMISSION INSTRUCTIONS
All files should be included in submission
In: Computer Science
How would I write a C++ code that gives me the following out put:
Enter count of male students: 14
Enter count of female students: 17
Students registered
Total: 31
Male: 14 45.16%
Female: 17 54.84%
Enter count of male students: 7
Enter count of female students: 2
Students registered
Total: 9
Male: 7 77.78%
Female: 2 22.22% */
In: Computer Science
The program prompts a user for the number of contestants entered in this year’s and last year’s Greenville Idol competition, and then it displays the revenue expected for this year’s competition if each contestant pays a $25 entrance fee.
The programs also display a statement that compares the number of contestants each year. Now, replace that statement with one of the following messages:
If the competition has more than twice as many contestants as last year, display The competition is more than twice as big this year!
If the competition is bigger than last year’s but not more than twice as big, display The competition is bigger than ever!
If the competition is smaller than last year’s, display, A tighter race this year! Come out and cast your vote!
Below is the source code.
using System;
using static System.Console;
class GreenvilleRevenue
{
static void Main()
{
const int ENTRANCE_FEE = 25;
string entryString;
int numThisYear;
int numLastYear;
int revenue;
bool isThisYearGreater;
Write("Enter number of contestants
last year >> ");
entryString = ReadLine();
numLastYear =
Convert.ToInt32(entryString);
Write("Enter number of contestants
this year >> ");
entryString = ReadLine();
numThisYear =
Convert.ToInt32(entryString);
revenue = numThisYear *
ENTRANCE_FEE;
isThisYearGreater = numThisYear >
numLastYear;
WriteLine("Last year's competition
had {0} contestants, and this year's has {1} contestants",
numLastYear,
numThisYear);
WriteLine("Revenue expected this
year is {0}", revenue.ToString("C"));
WriteLine("It is {0} that this
year's competition is bigger than last year's.",
isThisYearGreater);
}
}
Please show output and source code of how to get the displayed text.
In: Computer Science
In this assignment, you are required to write the SQL statements to answer the following queries using PostgreSQL system.
The SQL statements comprising the DDL for Henry Books Database are given to you in two files. For that database, answer the following queries. Create the files Q1 to Q10 in PostgreSQL. Do follow the restrictions stated for individual queries.
1. List the title of each book published by Penguin USA. You are allowed to use only 1 table in any FROM clause.
2. List the title of each book that has the type PSY or whose publisher code is JP. You are allowed to use only one condition term in any WHERE clause; i.e., don't use AND/OR boolean operations.
3. List the title of each book that has the type CMP, HIS, or SCI. You are allowed to use only one condition term in any WHERE clause.
4. List the title of each book written by John Steinbeck and that has the type FIC.
5. For each book, list the title (sorted alphabetically), publisher code, type and author names (in the order listed on the cover).
6. How many book copies have a price that is greater than $20 and less than $25?
7. For each publisher, list the publisher name and the number of books published by it, only if the publisher publishes at least 2 books.
8. For each book copy available at the Henry on the Hill branch whose quality is Excellent, list the book's title (sorted alphabetically) and author names (in the order listed on the cover).
9. Create a new table named FictionCopies using the data in the bookCode, title, branchNum, copyNum, quality, and price columns for those books that have the type FIC. You should do this in two steps: 9A) Create the table, and 9B) populate it with the said data.
10. Ray Henry is considering increasing the price of all copies of fiction books whose quality is Excellent by 10%. To determine the new prices, list the bookCode, title, and increased price of every book in Excellent condition in the FictionCopies table. You are not allowed to modify the prices in the table, just show them.
DB1: https://users.cs.fiu.edu/~navlakha/4710/HenryPSQL.sql
DB2: https://users.cs.fiu.edu/~navlakha/4710/HenryInventory.sql
In: Computer Science
Create separate class with these members
a, b, c, x, y, z
int a b c
float x y z
Demonstrate
1) A two arg float constructor, and a two arg int constructor to instantiate objects, initialize variables read from the keyboard, display the sum.
Note:- Please type and execute this above java program and also give the output for both problems. (Type a java program)
In: Computer Science
2. Show the trace of the RTL code for Booth's algorithm for X = 0111 and Y = 1011.
In: Computer Science
Write an Java/C program code to perform known-plaintext attack
on Permutation Cipher.
This program can be used to determine the length of the permutation
m and the
key permutation.
In: Computer Science
Using draw.io diagram tool, design a database schema for an application that tracks and manages students’ applications for a university. Make sure to create proper primary key for each entity. Add relations and specify cardinalities.
Use diamonds and the association on the arrow.
THINGS TO KEEP IN MIND :
In: Computer Science
In: Computer Science