Questions
ou must write tests for the following: You must write tests for the following (which may...

ou must write tests for the following:

You must write tests for the following (which may include Custom Exceptions):

  • BankAccount Class
    • Tests are written such that any deposit that is made greater than 10000 is not accepted.

    • Tests are written such that balance in the BankAccount does not go below 0.

    • Care should be taken for above tests at the time of Initial Deposit and at the time of Withdrawal and future Deposits.

    • Tests should be written such that the Bank AccountID only accepts a string of length 4 with first letter as a character followed by 3 integers, Eg., "A001", is a valid AccountID.

    • ==================================================================================================================

    • java code

      =============

      public class BankAccount {
              
              private String accountID;
              private double balance;
              
      
                 /**
                    Constructs a bank account with a zero balance
                    @param accountID - ID of the Account
                 */
                 public BankAccount(String accountID)
                 {   
                    balance = 0;
                    this.accountID = accountID;
                 }
      
                 /**
                    Constructs a bank account with a given balance
                    @param initialBalance the initial balance
                    @param accountID - ID of the Account
                 */
                 public BankAccount(double initialBalance, String accountID) 
                 {   
      
                              this.accountID = accountID;
                              balance = initialBalance;
                 }
                 
                 /**
                       * Returns the Account ID
                       * @return the accountID
                       */
                      public String getAccountID() {
                              return accountID;
                      }
                      
                      /**
                       * Sets the Account ID
                       * @param accountID
                       */
                      public void setAccountID(String accountID) {
                              this.accountID = accountID;
                      }
      
                 /**
                    Deposits money into the bank account.
                    @param amount the amount to deposit
                 */
                 public void deposit(double amount) 
                 {  
      
                              balance += amount;
                 }
      
                 /**
                    Withdraws money from the bank account.
                    @param amount the amount to withdraw
                    @return true if allowed to withdraw
                 */
                 public boolean withdraw(double amount) 
                 {   
                        boolean isAllowed = balance >= amount;
                        if (isAllowed)
                                balance -= amount;
                        return isAllowed;
                 }
      
                 /**
                    Gets the current balance of the bank account.
                    @return the current balance
                 */
                 public double getBalance()
                 {   
                    return balance;
                 }
                
              }
      

      ==========================================

In: Computer Science

Convert the following binary floating point  to decimal IEEE 32-bit floating point format.   0 1000 0101 000...

Convert the following binary floating point  to decimal

IEEE 32-bit floating point format.  

0 1000 0101 000 0100 1101 0000 0000 0000

In: Computer Science

(Triangle Inequality) Write a program triangle.py that takes three integers as command-line arguments and writes True...

(Triangle Inequality) Write a program triangle.py that takes three integers as command-line arguments and writes True if each one of them is less than or equal to the sum of the other two and False otherwise. This computation tests whether the three numbers could be the lengths of the sides of some triangle.

$ python3 triangle.py

3

4

5

True

$ python3 triangle.py

2

4

7

False

In: Computer Science

1) Tracing is a debugging technique that examines the computer system after each instruction is executed,...

1) Tracing is a debugging technique that examines the computer system after each instruction is executed, while breakpoints can be set at points of interest to examine the system. Which technique is better?

In: Computer Science

3. (Exercise 3.4) Use the Marriage data from the mosaicData package a) Create a bar plot...

3. (Exercise 3.4) Use the Marriage data from the mosaicData package a) Create a bar plot to show the frequency counts for each race b) Create a histogram to show the age distribution c) What distribution can you see for age? (Use comments to write in your R Markdown file) d) Create a time-series plot to show the delay by ceremony date (Note: you need to create a vector x<-1:98 first, and then create a new data frame with x=x and y=delay.)

In: Computer Science

24.10 Lab Ch24: MergeSortDouble Create a class MergeSortDouble and implement a sort(double[]) method using merge sort...

24.10 Lab Ch24: MergeSortDouble

Create a class MergeSortDouble and implement a sort(double[]) method using merge sort algorithm.

Test will call the sort() method.

java please!

In: Computer Science

We plan to develop customer’s database that stores customer’s number (ID), first name, last name and...

We plan to develop customer’s database that stores customer’s number (ID), first name, last name and balance. The program will support three operations: (a) reading and loading customer’s info from the text file, (b) entering new customer’s info, (c) looking up existing customer’s info using customer’s number(ID), (d) deleting the customer’s info and (e) the updated database will be stored in the text file after the program terminate.

Customer’s database is an example of a menu-driven program. When the program begins to execute, it first read the text file and upload customer’s info. Then it presents the user with a list of commands. The user can enter as many commands as desired, in any order. The a command prompts the user to enter customer’s number (ID), first name, last name and balance, which are then stored in the program’s database. The f command prompts the user to enter a customer number and then display the corresponding record on the screen. The q command saves the information in the database to the file specified by the user and terminate program.

Based on the project description, please design classes and their corresponding methods. You need describe each method and write API for each method (Leave method body blank) (Hint: you need design one driver class, one database class and one customer record class). Based on your design, please draw the UML diagram as well.

database.txt

12345 Sebastian vanDelden 123.22
11111 Sarah Smith 45.89
22222 Sue Johnson 7765.98
33333 Billy Hunts 374.99

Based on your design/code, please draw a simple but detailed UML diagram as well? (This is the question that needs to be answered!) the code isn't needed for this.

In: Computer Science

Write a SQL query that displays the number of customers from Mexico, USA, and Canada. Hint:...

Write a SQL query that displays the number of customers from Mexico, USA, and Canada. Hint: The result of the SQL query should look like the following table: CustomerCountNorthAmerica 21

In: Computer Science

What states can a pin of a µC have? How are they interpreted (by the MP)?

What states can a pin of a µC have? How are they interpreted (by the MP)?

In: Computer Science

Java Script Computer science Mad Libs Program - Mad Libs is a paper and pencil game...


Java Script
Computer science
Mad Libs Program -

Mad Libs is a paper and pencil game where a leader asks a group for specific words (nouns, verbs, adverbs, adjectives, names, numbers) that are then replaced in a story. The group does not know what the story is so the replaced words usually make the story funny.

You will write a Java Script program that:
* Informs the user what the program does using an alert
* Asks the user for eight words (two nouns, two verbs, three adjectives, and one adverb) using prompts
* Replace an existing story that you have already written with the words given to you by the user
* Show the new story
You will need to create a short story (three or four sentences) that contains the types of words you are asking the user to give you. You will be able to display the new story using document.write

You code needs all of the HTML required code and a comment. Save this file to your shared class folder, making sure you name it correctly using the class file naming convention.

In: Computer Science

Using the Web, search for “software firewalls.” Examine the various alternatives available and compare their functionality,...

Using the Web, search for “software firewalls.” Examine the various alternatives available and compare their functionality, cost, features, and type of protection. Create a chart with weighted rankings according to your own evaluation of the features and specifications of each software package. Additionally, provide 1-2 supporting paragraphs for your chart and describe how/why you came to your decision on the firewall weighted rankings.

In: Computer Science

Codes for this R-Project please! In this projects we will draw plots for different discrete probability...

Codes for this R-Project please!


In this projects we will draw plots for different discrete probability distributions that we have studied in class.

# 1. Binomial distribution.
We will plot the density function for the binomial distribution Bin(n, p).
Note:
1) The values for this random variable are 0, 1, 2, ..., n.
2) The density plot will have a bar of height P(X=k), at the point 'k' on the x-axis.
3) In the plot include a vertical line at the expected value of Bin(n,p).

Write a function plot_binom, that takes input values: n and p, and returns the density plot of Bin(n,p).


```{r}
# plot_binom <- function(n,p){
# x <- 0:n
# bin <- dbinom( _____ ) # input appropriate parameters
# mu_X <- ____ #input appropriate value for expected value
# plot(x, bin, type = "h", lwd = 5,
# main = paste("Binom density: n = ", n ,"and p = ", p),
# xlab = "x", ylab = "P(X=x)")
# abline(v = mu_X, col = 'red', lwd = 4)
# }
```
Fix n = 40. Compute plots for the following values of p: 0.05, 0.1, 0.4, 0.6, 0.9, 0.95.
Use the command "par(mfrow=c(3,2))" to have all the plots on the same frame.

```{r}
# n <- 40
# prob_vals <- c(_______) #input appropriate values for probability
# par(mfrow=c(3,2))
# for (p in prob_vals){
# plot_binom(____) #input the appropriate values
#}
```

Write at least two observations that you can note from these plots. Consider skewness and symmetry.

In: Computer Science

A file server needs to serve 20 users. Each user wants to download the same file...

A file server needs to serve 20 users. Each user wants to download the same file of size 100 MB. The server can upload data at 100 Mbps and each client can download at 10 Mbps. A, Estimate the minimal total time required to fully download the file by all users. B, Peer-to-Peer architecture( Assume each user can upload at 3 Mbps) c. Redo a and b for users=200

In: Computer Science

Make a simple C++ program not complex Any number is entered from keyboard of base 2,...

Make a simple C++ program not complex

  1. Any number is entered from keyboard of base 2, base 8, base 10 or base 16.
  2. Program asks for conversion options (menu) to convert into required base, i.e., 2, 8, 10 or 16.
  3. User selects the option and program converts the input number to the selected base number.
  4. Output number is shown on the screen.

Following points are to be considered while making the program:

  • It should be a menu driven program, use switch/case for menu. Program must have following options:
    Select Input Number Base
    1 for Binary
    2 for Octal
    3 for Decimal
    4 for Hexadecimal
    5 for Exit

    When user selects option from 1 to 5, User inputs the number.
    After number is entered, program displays following menu:
    1 for conversion to Binary
    2 for conversion to Octal
    3 for conversion to Decimal
    4 for converesion to Hexadecimal
    5 for Exit

    After user input, the program converts the input number to the given base, and displays the result.
  • After number display, pressing any key will again takes back to the first menu for input number.
  • Program should run until and unless user presses EXIT.

In: Computer Science

In your OWN words explain in detail the role of an operating system and list the...

In your OWN words explain in detail the role of an operating system and list the main operating systems used on today’s computers.

In: Computer Science