Construct a finite-state machine, using combinational logic for an apple vending machine that only accepts nickels (5 cents). When 15 cents is deposited the user can push a button to receive an apple and the machine resets. If the user inserts more than 15 cents no money will be returned.
In: Computer Science
Assignment 4: Objects that contain objects
In this assignment, you will implement a Java application, called
BankApplication, that can be used to manage bank accounts. The
application is to be implemented using three classes, called
Account, Customer, and BankDriver. The description of these classes
is below.
Problem Description
class Account
The Account class keeps track of the balance in a bank account with
a varying annual interest rate. The Account class is identified as
follows:
• two double instance variables, called balance and
annualRate.
• A constructor that takes two input parameters to initialize the
balance and annualRate instance variables.
• No-argument constructor to set both the balance and annualRate to
zero.
• Getters for both instance variables.
• deposit: a method than takes an amount (of type double) and adds
that amount of money to account's balance.
• withdraw: a method than takes an amount (of type double) and
withdraws that amount of money from the balance. If the amount to
be withdrawn is greater than the current balance, then the method
displays as error message and does not change the balance.
• addInterest: a method that adds interest to the balance at the
current rate. The method takes an input (of type int) indicating
how many years-worth of interest to be added. For example, if the
account's balance is 1000 and annualRate is 0.05, the call
addInterest(3) will add 3-years-worth of interest (i.e.,
3*1000*0.05) to the current balance. (Note that interest
calculations can be more complex if the second year's interest is
to be calculated using the first's year balance after adding first
year's interest and so on. However, for simplicity, you are not
required to implement this more complex interest
calculations).
• equals: a method to test the equality of two accounts. Two
accounts are considered to be equal if they have the same balance
and the same annualRate.
• toString: a method that returns a nicely formatted string
description of the account.
class Customer
The Customer class represents a bank customer. A customer is
identified by the following instance variables:
• name: a string that represents customer name
• checkingAccount: an instance variable of type Account
• savingAccount: an instance variable of type Account
Implement the following methods for the Customer class:
• A constructor that takes as input only the customer's name and
creates a customer with zero balance and zero rate in both
accounts.
• A constructor that takes five inputs that represent the
customer's name and four double variables that represent the
customer's checking account's balance, checking account's annual
rate, saving account's balance, and saving account's annual
rate.
• Getter methods for the saving and checking accounts.
• getTotalBalance: a method that calculates and returns the total
balance of a customer (which is the sum of the checking account's
balance and the saving account's balance).
• creditAccount: a method that takes two inputs to represent the
account type and an amount of money to deposit. Note that account
type is either 1 for saving account or 2 for checking account. The
method then calls the appropriate Account's deposit method to add
the specified amount of money. For example, the call
creditAccount(1,500) adds 500 to the saving account while the call
creditAccount(2,500) adds 500 to the checking account. The method
should display an error message if the first input is any number
other than 1 or 2.
• debitAccount: similar to creditAccount but it withdraws money
form the specified account.
• addInterest: similar to creditAccount, this method takes as input
account type and number of years. The method then adds interest to
the specified account.
• toString: a method that returns a string representation of the
customer that includes customer name, details of customer's
accounts and customer’s total balance.
class BankDriver
Your driver class should do the following actions:
• creates two customers with your choice of names, balances, and
annual rate values.
• adds 1 year-worth of interest to all checking accounts.
• adds 3 years-worth of interest to all saving accounts.
• Check whether the checking account of the first customer is equal
to the checking account of the second cusomter.
• prints all customers’ information in a nicely formatted
output.
Important Requirements
The output of our program must be nicely formatted.
• The programs should display your name.
• At the top of the program include your name, a brief description
of the program and what it does and the due date.
• Add appropriate comments to your code.
• All code blocks must be indented consistently and correctly.
Blocks are delimited by opening and closing curly braces. Opening
and closing curly braces must be aligned consistently.
• Variable names should convey meaning.
• The program must be written in Java and submitted via D2L.
Draw a UML diagram of your application that includes the Account
and Customer classes but not the BankDriver class.
In: Computer Science
The following code snippet is free of errors (issues that will prevent the code from compiling) but it does contain a major bug that will cause the program to hang (not finish running). Identify the problem and create a line of code to fix it.
#include <stdio.h> char get_input(); int main() { printf("The user's inputted letter is %c\n", get_input()); return 0; } char get_input() { printf("Please enter a letter: \n"); char input = getchar(); while (!(input >= 'a' && input <= 'z') && !(input >= 'A' && input <= 'Z')) { printf("You did not enter a letter! Try again\n"); } return input; }
In: Computer Science
Your code must print all the steps in the output as an Eg>
When you run your Merge sort code the sequence of output should be:
1) Enter input sequence
2) Show n/2 division of the input sequence
3) keep showing n/2 division of your sequence until you get one attribute
4) Sort first two numbers
5) Make a stack of 4 by merging 2 * 2 and sort them
6) keep showing merging and sorting until you show the final merging of last two stacks and sort them.
Similarly, show all the steps for Bubble sort.
Mostly need Bubble in Java, please.v
In: Computer Science
#include <stdio.h> #include <stdlib.h> #include <time.h> void sort(int a[], int size); void printArray(int a[], int size); int main(){ int arraySize, limit, count, srand(time(0)); print f("Enter the size of array\n"); scanf("%d", arraySize); int array[arraySize]; printf("Enter the upper limit\n"); scanf("%d", &limit); count = 0; while(count <= arraySize){ array[count] = (rand() % (limit + 1)); count++; } printArray(array, &arraySize); sort(array, arraySize); printArray(array, arraySize); Return 0; } void printArray(int a[], int size){ int i = 0; printf("Array: ["); while(i < size){ if(i != size - 1){ printf("%d, ", a[i]); } else { printf("%d]\n", a[i]); } printf("%d, ", a[i]); } }
Find the bugs in the given code and write the correct line of code where the bug is. There are a total of 7 bugs.
In: Computer Science
In: Computer Science
An information security officer reviews a report and notices a steady increase in outbound network traffic over the past ten months There is no clear explanation for the increase The security officer interviews several business units and discovers an unsanctioned cloud storage provider was used to share marketing materials with potential customers Which of the following services would be BEST for the security officer to recommend to the company?
NIDS
HIPS
CASB
SFTP
In: Computer Science
Apply one round of partition function in Quicksort on the following sequence: 32 41 92 13 75 18 26 87 53 57
In: Computer Science
Consider the following relational schema:
Salerep(sales_rep_ID, name, address, commission, rate)
Customer(customer_number, name, address, balance, credit_limit, sales_rep_ID)
Part(part_number, part_description, on_hand, class, warehouse, price)
Orders(order_number, order_date, customer_number)
Orderlilne(order_number, part_number, number_order)
Write SQL statements for the following queries:
a) Produce a list showing part_number, part_description, on_hand, and price sorted by part_description.
b) List customer’s name followed by order_number, part_description, and number_order.
c) List names of customers who have ordered the most expensive item(Hint: Use a nested SQL query to determine thehighest price.)
d) List the names of the sale_reps who have sold the most number of part “123”.(Hint: Use a nested SQL query for the FROM clause)
In: Computer Science
Compute 20191023 mod 7 without using calculator. Show every step.
In: Computer Science
A security analyst is reviewing an endpoint mat was found to have a rootkit installed. The root kit survived multiple attempts to clean the endpoint as well as an attempt to reinstall the OS. The security analyst needs to implement a method to prevent other endpoints from having similar issues. Which of the following would BEST accomplish this objective?
Utilize measured boot attestation
Enforce the secure boot process
Reset the motherboard's TPM chip
Reinstall the OS with Known-good media
Configure custom anti malware rules
In: Computer Science
Calculate the following issues in bit-level (signed values, two complement arithmetics)
a) 13 + 9 (use word lengths of 5 and 6 bits including the sign bit)
b) 11 – 17 (8-bit word length)
c) 9 * 5 (8-bit word length)
d) a-task using saturative arithmetics
In: Computer Science
Using pseudocode, write the code that will perform the necessary file operations as described in the short scenario below:
“During registration at a college, student’s details will be captured by a staff member and written to a file called “studentDetails.dat”. The following student details will be captured: name, surname, studentNumber, registeredCourse. The staff member will be prompted for the student details. After every record added to the file, the staff member will be asked whether they would like to add another record. If they choose not to add another record, the program should end.”
In: Computer Science
Write a PYTHON program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name will be a local variable. The program should display a letter grade for each score, and the average test score, along with the student's name.
Write the following functions in the program: calc_average - this function should accept 8 test scores as arguments and return the average of the scores per student.
determine_grade - this function should accept a test score average as an argument and return a letter grade for the score based on the following grading scale: 90-100 A 80-89 B 70-79 C 60-69 D Below 60 F.
In: Computer Science
Situation
The ABC team will unveil their latest and greatest product, The
FoodieX. The
FoodieX is a mobile application for food delivery from across the
city and
nearby neighborhoods. This application will be used by our company
to enjoy
food without the concern of going to the restaurant. Your job is to
manage the
IT Infrastructure for the staff running the application that has
approximately 20
people and ensure infrastructure continuity so they are able to
safely launch
The FoodieX.
Your Task
Your supervisor is sending you onsite! Before sending you onsite to
complete
the tasks, your supervisor wants to review your plan of attack and
review any
questions you have for them.
The current IT infrastructure has some dated hardware and your
supervisor
has been leaning towards a Ubiquiti stack. During the previous
onsite, your
supervisor noticed there were issues with the firmware and that
these systems
were not backed up.
Develop a plan on how you will implement the Ubiquiti Firewall and
Switches
and back up their systems.
Your plan should include any planned communication with the client,
the
outline of steps to be taken, risk assessment/rollback strategy,
and questions
for your supervisor
In: Computer Science