Questions
Program Specifications: You will be writing a Java program called ASCIIRabbit.java that will print the following...

Program Specifications:

You will be writing a Java program called ASCIIRabbit.java that will print the following ASCII objects. There should be two blank lines between each shape and your output must match identically.

 Rabbit In A Hat
--------------------

 (^\ /^)
  \ V /
  (o o)
 ( (@) )
---------
 |     |
 |     |
 |     |
 _______


 Rabbit Under A Hat
--------------------
 _______
 |     |
 |     |
 |     |
---------
  /\"/\
 () * ()
("")_("")


Rabbit Wears A Hat
------------------
 _______
 |     |
 |     |
 |     |
---------
  (o o)
 ( (@) )
  /\"/\
 () * ()
("")_("") 

Style requirements:

  1. Main comments - Be sure to include a comment in the main method as your begin each shape stating what shape you're about to print...like this:
    displayRabbitWearsHat();   //prints rabbit wearing hat
    
  2. Method comments - Be sure to include a comment above each method that describes the purpose of that method like this
    /* ***********************************************************************************
        displayRabbitWearsHat() - Displays the ASCII image of a rabbit wearing a hat
    ************************************************************************************ */
    public static void displayRabbitWearsHat() {
    
  3. Methods to be used - For this exercise, you will be defining several methods to assist you in drawing the objects and minimizes code redundancy (similar to the egg program we did in lecture). For this exercise, we are going to give you the methods you should use for a proper decomposition.
    • A method called displayRabbitEars: public static void displayRabbitEars() - Draws the portion of the rabbit that includes the ears only.
    • A method called displayRabbitFace: public static void displayRabbitFace() - Similar to above, but this method should display the face of the rabbit.
    • A method called displayRabbitBody: public static void displayRabbitBody() - Similar to above, but this method should display the body of the rabbit.
    • A method called displayHatTop: public static void displayHatTop() - This draws the first line of the hat.
    • A method called displayHatBottom: public static void displayHatBottom() - This draws the last line of the hat.
    • A method called displayHatBody: public static void displayHatBody() - This draws the middle of the hat.
    • A method called displayRabbitInHat: public static void displayRabbitInHat() - So now you can probably see where we are headed. We can draw any of the required rabbits by piecing together the different methods.
              displayRabbitEars();
              displayRabbitFace();
              displayHatBottom();
              //etc.
      
    • Methods for displayRabbitUnderHat() and displayRabbitWearsHat() - Continue using the above logic to develop the remaining rabbit methods. Then tie it all together with a main method that will display the ASCII graphics in the proper order.

Once you think you have your program decomposition properly created, test your program to see if your output matches the sample run from above. When it looks correct and you have it properly documented, submit it for grading.

In: Computer Science

Tip Calculator Instructions For this project you are to create a tip calculator that will take...

Tip Calculator Instructions

For this project you are to create a tip calculator that will take a decimal/or non decimal amount and calculate the different tip values of that amount:

10% 15% 20%

And display them appropriately. The values will be set to two decimal places. If you have an empty value, then a message will display informing the user of such. When the device is rotated the error message or tip information must continue to be displayed.

in Android/Java

In: Computer Science

Python class LinkedNode: # DO NOT MODIFY THIS CLASS # __slots__ = 'value', 'next' def __init__(self,...

Python

class LinkedNode:
    # DO NOT MODIFY THIS CLASS #
    __slots__ = 'value', 'next'

    def __init__(self, value, next=None):
        """
        DO NOT EDIT
        Initialize a node
        :param value: value of the node
        :param next: pointer to the next node in the LinkedList, default is None
        """
        self.value = value  # element at the node
        self.next = next  # reference to next node in the LinkedList

    def __repr__(self):
        """
        DO NOT EDIT
        String representation of a node
        :return: string of value
        """
        return str(self.value)

    __str__ = __repr__


# IMPLEMENT THESE FUNCTIONS - DO NOT MODIFY FUNCTION SIGNATURES #


def insert(value, node=None):
    pass


def to_string(node):
    pass


def remove(value, node):
    pass


def remove_all(value, node):
    pass


def search(value, node):
    pass


def length(node):
    pass


def sum_list(node):
    pass


def count(value, node):
    pass


def reverse(node):
    pass


def remove_fake_requests(head):
    pass

Testcases:

import unittest
from LinkedList import insert, remove, remove_all, to_string, search, sum_list, \
    count, reverse, length, remove_fake_requests


class TestProject2(unittest.TestCase):
    def test_insert(self):
        linked_list = insert(0)
        insert(1, linked_list)
        insert(2, linked_list)

        for i in range(0, 3):
            assert linked_list.value == i
            linked_list = linked_list.next

    def test_to_string(self):
        list1 = insert(0)
        insert(1, list1)
        insert(2, list1)
        insert(3, list1)

        assert to_string(list1) == "0, 1, 2, 3"

    def test_length(self):
        list1 = insert(1)
        insert(2, list1)
        insert(3, list1)

        assert length(list1) == 3

    def test_search(self):
        list1 = insert(0)
        insert(1, list1)
        insert(2, list1)

        assert search(2, list1)
        assert not search(3, list1)

    def test_count(self):
        list1 = insert(0)
        insert(1, list1)
        insert(2, list1)

        assert count(0, list1) == 1
        assert count(1, list1) == 1
        assert count(2, list1) == 1

    def test_sum_list(self):
        list1 = insert(0)
        insert(1, list1)
        insert(2, list1)
        insert(3, list1)

        assert sum_list(list1) == 6

    def test_remove(self):
        list1 = insert(0)
        insert(1, list1)
        insert(2, list1)
        insert(3, list1)

        list1 = remove(1, list1)
        for i in [0, 2, 3]:
            assert list1.value == i
            list1 = list1.next

        assert list1 == None

    def test_remove_all(self):
        list1 = insert(0)
        insert(1, list1)
        insert(0, list1)
        insert(2, list1)
        insert(3, list1)
        insert(0, list1)

        list1 = remove_all(0, list1)
        test_list = list1
        for i in [1, 2, 3]:
            assert test_list.value == i
            test_list = test_list.next

        assert test_list == None

    def test_reverse(self):
        list1 = insert(0)
        insert(1, list1)
        insert(2, list1)
        insert(3, list1)

        list1 = reverse(list1)

        for i in [3, 2, 1, 0]:
            assert list1.value == i
            list1 = list1.next

    def test_fake_requests(self):
        requests = insert(170144)
        insert(567384, requests)
        insert(604853, requests)
        insert(783456, requests)
        insert(783456, requests)
        insert(903421, requests)

        real_requests = remove_fake_requests(requests)
        for i in [170144, 567384, 604853, 903421]:
            assert real_requests.value == i
            real_requests = real_requests.next


if __name__ == "__main__":
    unittest.main()

Thanks!

In: Computer Science

The program Nadha Skolar wrote is supposed to read an integer value supplied by the user...

The program Nadha Skolar wrote is supposed to read an integer value supplied by the user that should be between 1-30. Using the value supplied (let's call it n), three different summation formulas should be calculated using three different methods. Nadha Skolar was supposed to write a program to read the user's input, ensure that it is a value between 1-30 and then call the appropriate methods to calculate the summations and print the results:

  • summationN() - Calculates and returns the summation of the first n integers. This should be calculated using n(n+1)/2
  • sumofOddN() - Calculates and returns the summation of the first n odd integers. This should be calculated using n2
  • sumOfSquaresN() - Calculates and returns the sum of squares of the first n integers ∑i2 from 1 to n. This should be calculated using n(n+1)(2n+1)/6

Sample Runs:

Run #1 (bad value for n):

Enter a number between 1-30 for the value of n: 0 <--- user enters the number for n
Program cannot continue. n must be a value 1-30.  <--- use a println

Run #2 (bad value for n):

Enter a number between 1-30 for the value of n: 31  <--- user enters the number for n
Program cannot continue. n must be a value 1-30. <--- use a println

Run #3:

Enter a number between 1-30 for the value of n: 3  <--- user enters the value for n

The summation of the first n numbers is: 6
The summation of the n odd numbers is: 9
The summation of n numbers squared is: 14 <--- use a println

Tips:

  1. Test your program in intelliJ before copying it back to zyBooks.
  2. When the program is working correctly, copy the code from intelliJ back to zyBooks and submit for grading.
  3. Important: You may NOT erase and re-write the entire program or an entire method. Your job is to fix Nadha's thinking and programming.

import java.util.*;

/* Name: NadhaSkolar Solution

public class NadhaStrikesAgain { //my best work yet! I have just learned about methods!
public static void main(String[] args) {

//get the value for n
Scanner scnr = new Scanner(System.in);
int n = getN();

//ensure n is usable
if ((n <= 0) && (n > 30)){
System.out.println("Program cannot continue. n must be a value 1-30.");
}

int sum = summationN(n);
int sumodd = sumofOddN(sum);
int sumSquares = sumOfSquaresN(n);

displayResults(sumodd, sum, sumSquares); //print them out
}
}

// ************************************************
// DESCRIPTION - getN() - prompts for n and returns value to main
// ************************************************
public static void getN(Scanner scnr) {
//prompt for a number,
System.out.print("Enter a number between 1-30 for the value of n: ");
int n = scnr.nextInt();
return n;
}

// ************************************************
// DESCRIPTION - addOdd() computes summation of first "num" odd numbers using the formula n^2
// ************************************************
public static double sumofOddN(int num) {
return(num^2);
}

// ************************************************
// DESCRIPTION - summation() - computes and returns the summation of i from to N
// ************************************************
public static int summationN(int num) {
return(num * num + 1 / 2);
}

// ************************************************
// DESCRIPTION - sumOfSquares() - computes and returns the sum of squares of first "num" numbers
// ************************************************
public static int sumOfSquaresN(int n) {
return((num * (num + 1) * (2 * num + 1) / 6));
}

// ************************************************
// DESCRIPTION - displayResults() - displays the various summations
// ************************************************
public static void displayResults(int sum, int oddSum, int sumSquares) {
System.out.println();
System.out.println("The summation of the first n numbers is: " + sum);
System.out.println("The summation of the n odd numbers is: " + oddSum);
System.out.println("The summation of n numbers squared is: " + sumSquares);
}
}
}

In: Computer Science

Instructions Write a Circle class (Circle.java) that has the following fields: - radius (double) - PI...

Instructions

Write a Circle class (Circle.java) that has the following fields:

- radius (double)

- PI (final double initialized to 3.1415) // no need to have setters or getters for this

Include the following methods:

- Constructor (accepts radius of circle as an argument)

- Constructor (no argument that sets radius to 0.0)

- setRadius (set method for radius field)

- getRadius (get method for radius field)

- calcArea (calculates and returns area of circle: area = PI * radius * radius)

- calcDiameter (calculates and returns diameter of circle: diameter = radius * 2)

- calcCircumference (calculates and returns circumference of circle: circumference = 2* PI * radius)

Write a test program (TestCircle.java) that will ask user for the radius, creates the circle object, and then displays the area, diameter, and circumference.

Make sure to create 2 circle object instances - one with the radius as an argument, one without but sets the radius with the setRadius() method.

Thank you so much for your help!!

In: Computer Science

Create 2 more batch files called devTracker.bat and showTracker.bat as follows: devTracker.bat a. This batch logs...

Create 2 more batch files called devTracker.bat and showTracker.bat as follows:
devTracker.bat
a. This batch logs an entry into a log file called C:\myTemp\devTracker.log
b. The entry in the log file should indicate the date and time of the VS launch as well as a message indicating
that you started Visual Studio. Please log all of this information on 1 line in the devTracker.log file
c. After making this log entry, devTracker.bat should run myStart.bat for you
showTracker.bat
d. Create another batch file called showTracker.bat that displays the contents of the devTracker.log
file in the command prompt window.

In: Computer Science

Java Prorgramming Skills Looping Branching Use of the length(), indexOf(), and charAt() methods of class String...

Java Prorgramming


Skills

  • Looping
  • Branching
  • Use of the length(), indexOf(), and charAt() methods of class String
  • Use of the static Integer.toHexString method to convert a character to its ASCII hex value

Description

In this assignment, you'll be URL encoding of a line of text. Web browsers URL encode certain values when sending information in requests to web servers (URL stands for Uniform Resource Locator).

Your program needs to perform the following steps:

  1. Prompt for a line of input to be URL encoded
  2. Read the line of text into a String (using the Scanner class nextLine method)
  3. Print the line that was read.
  4. Print the number of characters in the line (using String.length)
  5. Create an output String that is the URL encoded version of the input line (see below for details on encoding).
  6. Print the URL encoded String
  7. Print the number of characters in the encoded String.

To convert a String to URL encoded format, each character is examined in turn:

  • The ASCII characters 'a' through 'z', 'A' through 'Z', '0' through '9', '_' (underscore), '-' (dash), '.' (dot), and '*' (asterisk) remain the same.
  • The space (blank) character ' ' is converted into a plus sign '+'.
  • All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.

Use a for loop which increments it's index variable from 0 up to the last character position in the input string. Each iteration of the loop retrieves the character at the 'index' position of the input string (call the String class charAt() method on the input string). Use if statements to test the value of the character to see if it needs to be encoded. If encoding is not required, just concatenate it to the output encoded String. If encoding is required, concatenate the encoded value to the output encoded String. For example, if the input character is a blank, you want to concatenate a '+' character to the output encoded String (as described above).

Note: one technique to determine if a character is one that remains the same is to first create an initialized String containing all of the letters (both upper and lower case), digits, and other special characters that remain the same as described above. Then, call the String indexOf method on that String, passing the character to be tested. If -1 is returned from indexOf, the character was not one of those that remains the same when URL encoding.

For those characters that need to be converted into hex format (%xy above), you can call the pre-defined static Integer.toHexString method, passing the character as an argument. It returns the hex value of the character as a String, which you can concatenate to the encoded output String with the accompanying '%' symbol:

    String hexValue = Integer.toHexString(srcChar);
    encodedLine += '%' + hexValue;

Values that are URL encoded in this manner can be URL decoded by reversing the process. This is typically done by a web server upon receiving a request from a browser.

Sample Output

Enter a line of text to be URL encoded
This should have plus symbols for blanks

The string read is: This should have plus symbols for blanks
Length in chars is: 40
The encoded string: This+should+have+plus+symbols+for+blanks
Length in chars is: 40

Enter a line of text to be URL encoded
This should have hex 2f for /

The string read is: This should have hex 2f for /
Length in chars is: 29
The encoded string: This+should+have+hex+2f+for+%2f
Length in chars is: 31

Test Data

Use all the following test data to test your program, plus an example of your own:

This should have hex 2f for /
An encoded + should be hex 2b
123 and _-.* are unchanged
Angles, equals, question, ampersand > < = ? &

Getting started

Before you start writing Java code, it's usually a good idea to 'outline' the logic you're trying to implement first. Once you've determined the logic needed, then start writing Java code. Implement it incrementally, getting something compiled and working as soon as possible, then add new code to already working code. If something breaks, you'll know to look at the code you just added as the likely culprit.

To help you get started with this homework, here's an outline of the logic you'll need (sometime referred to as 'pseudo-code'):

Prompt for the line of input.
Read a line into the input string.

Set the encoded output string to empty.
Loop through each character in the input string.
{
Get the n'th character from the input string (use String's charAt method).

if (the character is a blank)
    concatenate '+' to the encoded output string
else if (the character remains unchanged)
    concatenate the character to the encoded output string
else
    concatenate '%' and the hex encoded character value
    to the encoded output string
}

Print the encoded output string.

Once you understand this logic, start writing your Java code. An example of the steps you could take are as follows:

  1. Create your Java source file with the public class and main() method (like homework 1).
  2. In the main() method, add code to prompt for the input line, read in the line of input, and print it out.
  3. Next, add the for-loop that loops through each character of the input string. You can use the length() method on your input string to get the number of characters in it to control your loop.
  4. The first statement in the loop should call charAt() on the input string to get the next character to examine.
  5. To check things are working ok so far, make the next statement in the loop print out the character position (the for-loop index variable) and character from the string.
  6. Get this much compiled and running first.

With this much done, if you read in a line containing "hello", you'd get output something like this from the temporary output statement within the loop:

char 0 is h
char 1 is e
char 2 is l
char 3 is l
char 4 is o

Once you've got this compiled and working, starting adding the if/else-if/else logic inside the loop to build the encoded output string.

I have this so far.What am I doing wrong here,please let me know. The code has to fit this requirement.

For those characters that need to be converted into hex format (%xy above), you can call the pre-defined static Integer.toHexString method, passing the character as an argument. It returns the hex value of the character as a String, which you can concatenate to the encoded output String with the accompanying '%' symbol:

    String hexValue = Integer.toHexString(srcChar);
    encodedLine += '%' + hexValue;

Values that are URL encoded in this manner can be URL decoded by reversing the process. This is typically done by a web server upon receiving a request from a browser.

I don't how to fit the last requirement

here is my code so far

import java.util.Scanner;

   public class URLEncoding {

       public static final String Notencodedchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~*'()"; }
  
      
       public static void main1(String args[]) {
           System.out.println("Enter a line of text to be URL encoded");
   // Create a scanner to read from keyboard
@SuppressWarnings("resource")
   Scanner sc = new Scanner (System.in);
String input = sc.nextLine();
System.out.println("The String read is :");
System.out.println("Length in chars is: "+input.length());
String Encoded ="";
char c;
for (int indexOf = 0; indexOf < input.length(); indexOf ++) {
  
       char ch = input.charAt(indexOf);
       if(Notencodedchars.indexOf(c) != -1)
               {
  
              
               Encoded += c;
               }
               else
               {
               if(c == ' ')
               //Encoded.concat("+");
               Encoded += '+';
               else
               {
                   public static String toHexString(int i) {
                   return toUnsignedString0(i, 4);
                   }
               private static String toUnsignedString0(int i, int j) {
                           // TODO Auto-generated method stub
                           return null;
                       }
                   String hexValue = Integer.toHexString(srcChar);
               encodedLine += '%' + hexValue;
               }
               }
       System.out.println("The encoded string is :"+ encodedString.toString());

       System.out.println("Length in chars is :" + encodedString.toString().length());

       }

       }


Someone ,please correct this for me.

In: Computer Science

As it relates to C#: Though the function of switch case and else if ladder is...

As it relates to C#:

Though the function of switch case and else if ladder is same, there are a number of  difference between switch case and else if ladder, Explain the differences in two areas such (memory consumption, speed of processing, variable requirement) etc.

In: Computer Science

Please code in c# (C-Sharp) Write a program that will ask the user for their name....

Please code in c# (C-Sharp)

Write a program that will ask the user for their name. If the user does not input anything, display a

warning before continuing. The program will then ask the user whether they want to have an addition,

subtraction, multiplication, or division problem. Once the user indicates their choice, the program will

display 2 randomly generated numbers from 1 to 9 in a math problem matching the user’s choice.

Example: user selects addition, the equation presented is:

(random number from 1 to 9) + (random number from 1 to 9)

The user will then input an answer as a whole number. If the answer they entered is not a whole

number, tell the user their input is invalid and end the program. If the input is valid, check to see if it is

the correct answer. If correct, congratulate the user by name. If incorrect, output the correct answer.

Tasks

1) The program needs to contain the following

a.

A comment header containing your name and a brief description of the program

b. At least 5 comments besides the comment header explaining what your code does

c.

A string variable that captures the user’s name

d. A way to validate user input to determine if they entered an empty string

i. Warn the user if they enter an empty string

ii. Continue the program after warning the user

e. A prompt for what type of quiz the user wants

f.

Display of a quiz matching the type the user requested

g.

A prompt for an answer in the form of a whole number

i. A message if the user enters an invalid number

1. Do not check the user’s answer if their input is invalid

ii. If input is valid:

1. Check the answer

2. If the answer is correct, congratulate the user by name

3. If incorrect, output the correct answer

h. “Press enter to continue” and Console.ReadLine(); at the end of your code

i. Note: if you write a try-catch statement, these lines will be after your last catch

2) Upload a completed .cs file onto the Assignment 4 submission folder and a word document

containing the following six (6) screenshots:

a.

The warning displayed when the user enters a blank value for the name

b. One test run for each equation with valid input

i. Answer 2 quizzes correctly

ii. Answer 2 quizzes incorrectly

c.

One test run with invalid input

In: Computer Science

Write C functions to do each of the following. Make sure your function has exactly the...

Write C functions to do each of the following. Make sure your function has exactly the same name, parameters, and return type as specified here. Please place all of the functions in a single .c file and write a main() to test them.

  1. int process(const char *input_filename, const char *output_filename) — reads the file named input_filename and processes it, putting results in output_filename. The input file consists of lines of the form "number operation number," for example:

    15 - 4
    3.38 / 2.288
    2 ^ -5
    35.2 + 38

    The possible operations are +, -, *, /, and ^ (power). Your function should calculate the value of each line's expression and save it (one to a line) to the output file. For example, the input file shown above would result in an output file of

    11.000000
    1.477273
    0.031250
    73.200000

    The return value of the function should be the number of calculations that it did (4 for this example file).

    (Hints: fscanf() returns the constant value EOF when the end of file is reached. The pow(x, y) function defined in <math.h> calculates xy; you will need to add -lm to the command line when compiling your code to link the math library.)

In: Computer Science

In C++ You will create 3 files: The .h (specification file), .cpp (implementation file) and main...

In C++

You will create 3 files: The .h (specification file), .cpp (implementation file) and main file. You will practice writing class constants, using data files. You will add methods public and private to your BankAccount class, as well as helper methods in your main class. You will create an arrayy of objects and practice passing objects to and return objects from functions. String functions practice has also been included. You have been given a template in Zylabs to help you with this work. The data file is also uploaded.

  1. Extend the BankAccount class. The member fields of the class are: Account Name, Account Id, Account Number and Account Balance. The field Account Id (is like a private social security number of type int) Convert the variables MIN_BALANCE=9.99, REWARDS_AMOUNT=1000.00, REWARDS_RATE=0.04 to static class constants Here is the UML for the class:

                                                        BankAccount

-string accountName // First and Last name of Account holder

-int accountId // secret social security number

-int accountNumber // integer

-double accountBalance // current balance amount

+ BankAccount()                     //default constructor that sets name to “”, account number to 0 and balance to 0

+BankAccount(string accountName,int id, int accountNumber, double accountBalance)   // regular constructor

+getAccountBalance(): double // returns the balance

+getAccountName: string // returns name

+getAccountNumber: int

+setAccountBalance(double amount) : void

+equals(BankAccount other) : BankAccount // returns BankAccount object **

-getId():int **

+withdraw(double amount) : bool //deducts from balance and returns true if resulting balance is less than minimum balance

+deposit(double amount): void //adds amount to balance. If amount is greater than rewards amount, calls

// addReward method

-addReward(double amount) void // adds rewards rate * amount to balance

+toString(): String   // return the account information as a string with three lines. “Account Name: “ name

                                                                                                                                                   “Account Number:” number

                                                                                                                                                    “Account Balance:” balance

  1. Create a file called BankAccount.cpp which implements the BankAccount class as given in the UML diagram above. The class will have member variables( attributes/data) and instance methods(behaviours/functions that initialize, access and process data)
  2. Create a driver class to do the following:
    1. Read data from the given file BankData.data and create and array of BankAccount Objects

The order in the file is first name, last name, id, account number, balance. Note that account name consists of both first and last name

  1. Print the array (without secret id) similar to Homeowork2 EXCEPT the account balance must show only 2 decimal digits. You will need to do some string processing.
  2. Find the account with largest balance and print it
  3. Find the account with the smallest balance and print it.
  4. Determine if there are duplicate accounts in the array. If there are then set the duplicate account name to XXXX XXXX and rest of the fields to 0. Note it’s hard to “delete” elements from an array. Or add new accounts if there is no room in the array. If duplicate(s) are found, print the array.

Create BankAccount.h.

This is given for BankAccount.cpp:

#include <string>
#include <iostream>
#include "BankAccount.h"

// BankAccount::BankAccount();

BankAccount::BankAccount(std::string accountName, int id, int accountNumber, double accountBalance){
//

}
//getters
  
std::string BankAccount::getAccountName(){
//
}
int BankAccount::getAccountNumber(){
//
}
double BankAccount::getAccountBalance(){
//
}
  
void BankAccount::setAccountBalance(double accountBalance){
//
}
std::string fixPoint(std::string number){
//adjust the two decimal places
}
std::string BankAccount::toString(){

}

bool BankAccount::withdraw(double amount){

//
}
  
void BankAccount::deposit(double amount){
//
}

This is given for main.cpp:

#include <iostream>
#include <fstream>
#include <string>
#include //your header file

using namespace std;
const int SIZE = 8;
void fillArray (ifstream &input,BankAccount accountsArray[]);
int largest(BankAccount accountsArray[]);
int smallest(BankAccount accountsArray[]);
void printArray(BankAccount accountsArray[]);
int main() {

//open file
//fill accounts array
//print array
//find largest
//find smallest
//find duplicates and print if necessary
BankAccount accountsArray[SIZE];
  
fillArray(input,accountsArray);
printArray(accountsArray);
cout<<"Largest Balance: "<<endl;
cout<<accountsArray[largest(accountsArray)].toString()<<endl;
cout<<"Smallest Balance :"<<endl;
cout<<accountsArray[smallest(accountsArray)].toString()<<endl;
}
}
void fillArray (ifstream &input,BankAccount accountsArray[]){

}

int largest(BankAccount accountsArray[]){
//returns index of largest account balance
}
int smallest(BankAccount accountsArray[]){
//returns index of smallest

}
BankAccount removeDuplicate(BankAccount account1, BankAccount account2){

return (account1.equals(account2));

}
void printArray(BankAccount accountsArray[]){
cout<<" FAVORITE BANK - CUSTOMER DETAILS "<<endl;
cout<<" --------------------------------"<<endl;
//print array using to string method

}

file "BankData.dat" contains:

Matilda Patel 453456 1232 -4.00
Fernando Diaz 323468 1234 250.0
Vai vu 432657 1240 987.56
Howard Chen 234129 1236 194.56
Vai vu 432657 1240 -888987.56
Sugata Misra 987654 1238 10004.8
Fernando Diaz 323468 1234 8474.0
Lily Zhaou 786534 1242 001.98

In: Computer Science

Debug the following program.Each line that has a number and line at the end of it...

Debug the following program.Each line that has a number and line at the end of it has an error. The error can be syntax or logic. Correct the error. Rewrite the correct answer in place of the original code :

private void btnCalculate_Click (object sender, System.EventArgs e)

{

intLimit = zero; //

intCounter == 1; // counter need to begin at 1

lstResults.Items.Empty(); // clear ListBox

intLimit = Int32.Parse( txtInput); // retrieve user input from GUI

lstResults.Items.Add( "N/tN^2/tN^3" ); // add header with tabs

calculate and display square and cube of 1 to intLimit

while ( intCounter <= intLimit ) ;

lstbx.Items.Add( intCount = "\t" + Math.Pow( intCount, 2 );

Math.Pow( intCount 3^ );                   

intCount++;                                                        // increment counter

}

In: Computer Science

Convert 0xCD001234 from IEEE-754 hexadecimal to single-precision floating point format. Please show every single detail for...

Convert 0xCD001234 from IEEE-754 hexadecimal to single-precision floating point format.
Please show every single detail for upvote.
Please do not answer otherwise.

In: Computer Science

a style sheet was not new with HTML and even today other languages use a similar...

a style sheet was not new with HTML and even today other languages use a similar approach. JavaFX uses an almost identical style definition as CSS for its style sheets. .NET's Windows Presentation Foundation (WPF) uses an XML like style definition in a language named XAMLAll these different technologies have one thing in common: they separate what is being displayed from how it is being displayed. Why? What is the benefit of doing so, if any? What are the drawbacks, if any? For those of you who may have taken a software architecture/engineering class, the style sheet follows a, currently, very popular architecture, do you know what it is?

120 WORDS MINIMUM

In: Computer Science

Scenario Create an algorithm to solve the maximum subarray problem. Find the non-empty, contiguous subarray of...

Scenario
Create an algorithm to solve the maximum subarray problem. Find the non-empty, contiguous subarray of the input array whose values have the largest sum. You can see an example array with the maximum subarray indicated in the following diagram:

Screen Shot 2019-01-07 at 10.58.06 AM.png
The O(n2) brute force algorithm that tests all combinations for the start and end indices of the subarray is trivial to implement. Try to solve this using the divide and conquer algorithm.

Aim
To design and implement an algorithm to solve the maximum subarray problem with a better runtime than the O(n2) brute force algorithm, using a divide and conquer approach.

Prerequisites
You need to implement the maxSubarray() method of the MaximumSubarray class in the source code, which returns the sum of values for the maximum subarray of the input array. Assume that the sum always fits in an int, and that the size of the input array is at most 100,000.

public class MaximumSubarray {
public Integer maxSubarray(int[] a) {
return null;
}
}
The divide and conquer approach suggests that we divide the subarray into two subarrays of as equal size as possible. After doing so, we know that a maximum subarray must lie in exactly one of following three places:

Entirely in the left subarray
Entirely in the right subarray
Crossing the midpoint
Steps for Completion
The maximum subarray of the arrays on the left and right is given recursively, since those subproblems are smaller instances of the original problem.
Find a maximum subarray that crosses the midpoint.

In: Computer Science