Questions
Intro to App Development with Swift by Apple education, Apple Education ITEC245, iOS App Development Description:...

Intro to App Development with Swift by Apple education, Apple Education

ITEC245, iOS App Development

Description: Write a report with your self reflection and learning outcome on below topics:

1. Playground Basics with sample program , Naming and Identifiers with sample program , Strings with sample program , First App with sample program , Functions with sample program

In: Computer Science

Exercise 3.4.1 In P3_4_1.cpp (BELOW), right at the beginning, the program initializes choice to 1. This...

Exercise 3.4.1

In P3_4_1.cpp (BELOW), right at the beginning, the program initializes choice to 1. This forces the while loop to run at least once. If you use a do ... while instead, you wouldn't need to initialize the choice. Re-write the below program, call the new program ex341.cpp, so that is uses do ... while. Do not initialize the choice to 1 this time. Compile and run the program.

Answer questions:

Does the program work the same way? Write your answer as a comment inside the code of your ex341.cpp file.  

// P3_4_1.cpp - Read and average some integers, print the result.

// This program continue asking for a new number until the user enters a 0 to terminate the program

#include <iostream>  using namespace std;  

int main(void)  

{      int x;

        int count = 0; // (1) initialize a counter to 0 to count number of values  

        int choice = 1; // This is the choice that controls the looping continuation or termination          

        double sum = 0; // initialize sum to 0 to make sure sum at the beginning is 0              

        double average;  

        while( choice == 1) // (2) read N grades and compute their sum, count ensures N entries  

       {

              // read each number and compute the sum:  

              cout << "\n Enter a grade <Enter>: ";               

              cin >> x;               

              sum = sum + x;  

             count++; // (3) update the count  

            // prompt the user:              

            cout << "Do you wish to enter another grade? (1 for yes and 0 or other key for no): "

                   << endl;  

            cin >> choice;

        }

        if(count == 0)  

              cout << "You haven't entered any number. No average will be computed. Bye!\n";            

        else{

              average = sum/count; //Notice that we have divided by count this time  

              cout << "The average of these " << count << " grades is " << average <<"." << endl;  

        }

        return 0;  

}  

In: Computer Science

Implement a C program that writes and reads as binary data the first 1048576 = 2^20...

Implement a C program that writes and reads as binary data the first 1048576 = 2^20 integer individually to and from a file on HDD.

In: Computer Science

Question 2. The following code defines an array size that sums elements of the defined array...

Question 2. The following code defines an array size that sums elements of the defined array through the loop.

  1. Analyze the following code, and demonstrate the type of error if found?
  2. What we can do to make this code function correctly?

#include <stdio.h>

#define A 10

int main(int argc, char** argv) {

int Total = 0;

int numbers[A];

for (int i=0; i < A; i++)

numbers[i] = i+1;

int i =0;

while (i<=A){

   Total += numbers[i];

   i++;

}

printf("Total =%d\n", Total);

return 0;

}

Submission

For this assignment, you need to write a report file of your work. The report should answer each question in details, providing outputs of the code to justify your answer.

In: Computer Science

“Pick any website that is interesting for you and choose two objects which are there. Write...

“Pick any website that is interesting for you and choose two objects which are there. Write the part of code in how they are implementedFor example, I picked SEU website and I chose (Saudi Electronic University Copyrights) where is in the bottom of the first webpage. This is done by writing <footer> ...</footer> element”

In: Computer Science

Submit: One python file __name__ == "__main__" Screenshot of sample output Be sure to: Comment your...

Submit:

  • One python file __name__ == "__main__"
  • Screenshot of sample output

Be sure to:

  • Comment your code, classes and functions! Practice practice practice!
  • Use meaningful variables
  • If you do not I will remove points

Dog Walker Program

  • Create a program for a Dog Walking company to keep track of its employees, customers, and customer dogs
  • You will need the following classes:
    • Person
      • With the following attributes:
        • name
        • id_number
        • dogs : list of Dog objects
      • With the appropriate setters and getters
      • With the following subclasses:
        • DogWalker(Person)
          • With the following attributes:
            • hourly_rate : float
          • With the appropriate setters and getters
        • Customer(Person)
          • With the following attributes
            • amount_owed : float, how much they currently owe
          • With the appropriate setters and getters
    • Dog
      • With the following attributes
        • name
        • breed
        • weight
        • hours_walked
      • With the appropriate setters and getters

Programming language: Python

requirement: please follow up the rules per demonstrated.

In: Computer Science

Suppose we want to define an analogue of the IEEE 754 standard for 14 bits, with...

Suppose we want to define an analogue of the IEEE 754 standard for 14 bits, with 1 bit for sign, 6 bits for (biased) exponent, and 7 bits for the significand. Assume exponent 000000 and 111111 are reserved for 0, denormal, NaN and infinity, just like IEEE 754 standard.

a) What is the bias for the exponent? Express it in decimal.

b) What is the smallest positive denormalized number?

c) What is the smallest positive normalized number?

d) What is the largest positive normalized number (excluding infinity)?

In: Computer Science

Create a rock paper scissors game against the computer using bunch of methods. -No two dimensional...

Create a rock paper scissors game against the computer using bunch of methods.

-No two dimensional arrays

-No java.util.random

-No ragged arrays

-Methods only, and one dimensional arrays

In: Computer Science

Problem Statement In a restaurant, if you were pleased by the waiter's service, you may leave...

Problem Statement

In a restaurant, if you were pleased by the waiter's service, you may leave him a tip -- you pay him more than the actual value of the bill, and the waiter keeps the excess money. In some countries, not leaving a tip for the waiter is even considered impolite. During my recent holiday I was having dinner in a foreign restaurant. The pamphlet from my travel agency informed me that the proper way of tipping the waiter is the following:

  • The sum I pay must be round, i.e., divisible by 5.
  • The tip must be between 5% and 10% of the final sum I pay, inclusive.

Clearly, sometimes there may be multiple "correct" ways of settling the bill. I'd like to know exactly how many choices I have in a given situation. I could program it easily, but I was having a holiday... and so it's you who has to solve this task. You will be given:

  • an int bill -- the amount I have to pay for the dinner
  • an int cash -- the amount of money I have in my pocket

Write a function that computes how many different final sums satisfy the conditions above.

Constraints

  1. Assume that both bill and cash are in dollars.
  2. All the money I have is in one-dollar banknotes.

Examples

  1. 4  100
    
    Returns:  0
    

    4 isn't a round sum, and 5 is too much.

  2. 23  100
    
    Returns: 1
    

    The only correct choice is to pay 25 dollars, thus leaving a tip of 2 dollars.

  3. 23  24
    
    Returns: 0
    
    The same bill, but I don't have enough money to leave an appropriate tip.
  4. 220  239
    
    Returns: 1
    
    This time, it is appropriate to pay either 235 or 240 dollars. Sadly, I don't have enough money for the second possibility.
  5. 1234567  12345678
    
    Returns: 14440
    
    A large bill, but with that much money I don't care.
  6. 1880000000  1980000000
    
    Returns: 210527
    
  7. 171000000  179999999
    
    Returns: 0

Given Function

int possible_payments(int bill, int cash) {
// fill in code here
}


Answer the problem statement by completing the Given Function. Follow the constraints and examples.

In: Computer Science

Write a python program. The function protocol implements the functionality of the diagnostic protocol. The main...

Write a python program.
The function protocol implements the functionality of the diagnostic protocol. The main idea of this function is to call the functions that you
have already implemented in the previous questions. See below for an explanation of exactly what is
expected.
def protocol(my_symptoms: Tuple[Set], all_patients_symptoms: Dict[str, Tuple[Set]],
all_patients_diagnostics: Dict[int, str]) -> str:

'''Return the diagnostic for my_symptoms based on the dictionary of patients symptoms
(all_patients_symptoms) and the dictionary of patients diagnostics
(all_patients_diagnostics).
Hint: This function selects the patients with the highest similarity between the their
symptoms and my_symptoms (by calling the function similarity_to_patients). Then, it
reports the the most frequent diagnostic from the patients with the highest symptoms
similarity (by calling the function getting_diagnostics).
>>>protocol(yang, all_patients_symptoms, all_patients_diagnostics)
'cold'
'''

In: Computer Science

Assume that the CES board of directors has asked you to examine the ERP system implementation...

Assume that the CES board of directors has asked you to examine the ERP system implementation process. Please identify:
2.1. Business issues related to ERP system implementation;
2.2. Organizational issues related to ERP system implementation. What would be the best practices for handling those issues?

In: Computer Science

Java Programming import java.io.File; import java.util.LinkedHashMap; import java.util.Scanner; import javax.swing.JFrame; import org.math.plot.Plot2DPanel; import java.awt.Container; import java.awt.BorderLayout;...

Java Programming

import java.io.File;

import java.util.LinkedHashMap;

import java.util.Scanner;

import javax.swing.JFrame;

import org.math.plot.Plot2DPanel;

import java.awt.Container;

import java.awt.BorderLayout;

public class Heart {

    public static LinkedHashMap<String,double[]> readData(final Scanner fsc) {

        final LinkedHashMap<String, double[]> result = new LinkedHashMap<String, double[]>();

        fsc.nextLine();

        String State;

        String line;

        String[] parts;

        double[] values;

        while (fsc.hasNextLine()) {

            line = fsc.nextLine();

            parts = line.split("\t");

            State = parts[0];

            values = new double[parts.length - 1];

            for (int i = 1; i < parts.length; i++) {

                values[i - 1] = Double.parseDouble(parts[i]);

            }

            

            result.put(State, values);

        }

        

        return result;

    }

   

    public static double[] getDays(final int howMany) {

        final double[] result = new double[howMany];

        for (int i = 0; i < howMany; i++) {

            result[i] = i;

        }

        return result;

    }

    public static void setUpAndShowPlot(final Plot2DPanel plot) {

        final JFrame frm = new JFrame();

        frm.setBounds(100, 100, 500, 500);

        frm.setTitle("Investment Curves");

        frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        final Container c = frm.getContentPane();

        c.setLayout(new BorderLayout());

        plot.addLegend("SOUTH");

        plot.setAxisLabels("Day", "Deaths");

        c.add(plot, BorderLayout.CENTER);

        frm.setVisible(true);

    }

    public static void main(final String[] args) throws Exception {

        LinkedHashMap<String, double[]> accounts;

        String inputtedStates;

        String[] names;

        final Scanner sc = new Scanner(System.in);

        double[] DeathValues;

        try {

            final Scanner fsc = new Scanner(new File("States.txt"));

            accounts = readData(fsc);

        } catch (final Exception ex) {

            accounts = null;

        }

        if (accounts == null) {

            System.out.println("Couldn't read the file.");

        } else {

            do {

                System.out.print("Enter name of States separated by commas: ");

                inputtedStates = sc.nextLine();

                if (!inputtedStates.equalsIgnoreCase("exit")) {

                    final Plot2DPanel plot = new Plot2DPanel();

                     names = inputtedStates.split(",");

                    for (String name : names) {

                        name = name.trim();

                        if (!accounts.containsKey(name)) {

                            System.out.printf("%s is not in the data.\n", name);

                        } else {

                            DeathValues = accounts.get(name);

                            plot.addLinePlot(name, getDays(DeathValues.length), DeathValues);

                        }

                    }

                    // configure and show the frame that houses the plot

                    setUpAndShowPlot(plot);

                }

            } while (!inputtedStates.equalsIgnoreCase("exit"));

            System.out.println("Thank you");

        }

    }

}

This code uses a tab delimited  text file to graph cumulative Heart attack deaths per state. below is an example of the text files format. Instead of having the name if the file built in ("States.txt") change the code so it askes the user to input a name of a text file
Also the Data is cumulative in the text file. This Data must be turned in daily totals to be graphed. for example Ohio day 1 would have 5 deaths ohio day 2 would have 5 deaths and ohio day 7 would have 11 deaths. Please make the proper changes to the code

Note: jmathio and jmathplot jar files are required

State   0   1   2   3   4   5
Ohio   5   10   17   21   32   50
Texas    2   7   9   45   51   56  
Florida   5   8   12   18   27   51
Utah   1   3   7   9   18   21

In: Computer Science

Can you please post the most/main important terminologies for Python coding and explain what they mean...

Can you please post the most/main important terminologies for Python coding and explain what they mean (e.g. Class - xyz, function - xyz, conductor - xyz, method - xyz, instance variable - xyz, variable - xyz) (Feel free to add anything I may have missed or that you think is also important)?

In: Computer Science

Write method reverseStack(Stack s) that receives a stack s and reverse the order of its elements....

Write method reverseStack(Stack s) that receives a stack s and reverse the order of its elements.

the values inside the stack must be changed, that the top will be the last and so on.

please use java code to slove.

Thank you.

In: Computer Science

Please Code Using Java Create a class called SoccerPlayer Create 4 private attributes: First Name, Last...

Please Code Using Java

Create a class called SoccerPlayer

Create 4 private attributes: First Name, Last Name, Games, and Goals

Have two constructors

Constructor 1 – default constructor; all values to "NONE" or zero

Constructor 2 – accepts input of first name, last name, games and goals.

Create get and set methods for each of the four attributes

Create a method the returns a double that calculates the average goals per game

This method checks for zero games played:

If there are zero played, display an error and set average to 0;

If greater than zero, do the math and set average to result of calculation

Create a test program that allows you to set the first name, last name, number of games and number of goals. Call it SoccerPlayerTest.

Create two instances of players.

The first should use the default constructor and the set methods to fill the attributes

The second should use the other constructor to set the attributes

Display the info about the players including the average goals per game.

In: Computer Science