1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
asambeis [7]
3 years ago
15

Create detailed pseudocode for a program that calculates how many days are left until Christmas, when given as an input how many

weeks are left until Christmas. Use variables named weeks and days.
Computers and Technology
1 answer:
Sedaia [141]3 years ago
6 0

Answer:

Following are the Pseudocode for the above problem:

Explanation:

  • Declare weeks and days As Variables
  • Output: "Enter the input for weeks are left until Christmas."
  • Set weeks = user answer
  • Set days = weeks *7
  • Output: “The days left until Christmas is ”
  • Output: days.

Output:

  • If the user inputs 2 then the output is "The days left until Christmas is 14"
  • If the user inputs 3 then the output is "The days left until Christmas is 21"

Pseudocode Explanation:

  • Pseudocode is the solution to any problem which is written in the form of the English language.
  • The only difference between the algorithm and Pseudocode is that the algorithm is only written in English and the Pseudocode is written in the form of input and output.

You might be interested in
3. Round off to the nearest hundredth (2 decimal places).
blagie [28]
<h3>#a</h3>

\boxed{ \mathfrak{3.752 = 3.75}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#b</h3>

\boxed{ \mathfrak{0.506 = 0.51}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#c</h3>

\boxed{ \mathfrak{3.966 = 3.97}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#d</h3>

\boxed{ \mathfrak{1.838 = 1.84}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#e</h3>

\boxed{ \mathfrak{30.063 = 30.7}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#f</h3>

\boxed{ \mathfrak{404.759 = 404.76}}

3 0
2 years ago
Which of the following statements best reflects the difference between Warner Brothers and MGM?
schepotkina [342]

Answer:

MGM started in film production, while Warner Bros started in distribution.

Explanation:

Metro-Goldwyn-Mayer Studios Inc or MGM was founded in 1924 for Marcus Loew, located at 245 North Beverly Drive in Beverly Hills, California, this company produce feature films and television programs.

Warner Bros. Entertainment Inc was founded in 1923 for Harry, Albert, Sam, and Jack Warner, this company has operations in areas such as film, television, and video games, In 1918 they opened the first Warner Brothers Studio on Sunset Boulevard in Hollywood. Handled finance and distribution in New York City. During World War I their first nationally syndicated film, My Four Years in Germany.

7 0
3 years ago
You are asked to simulate a binary search algorithm on an array of random values.An array is the list of similar type of element
Alex Ar [27]

Answer:

Explanation:

Problem statement:

to simulate a binary search algorithm on an array of random values.

Binary Search: Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half. Repeatedly check until the value is found or the interval is empty.

Input/output description

Input:

Size of array: 4

Enter array:10  20 30 40

Enter element to be searched:40

The Output will look like this:

Element is present at index 3

Algorithm and Flowchart:

We basically ignore half of the elements just after one comparison.

Compare x with the middle element.

If x matches with middle element, we return the mid index.

Else If x is greater than the mid element, then x can only lie in right half subarray after the mid element. So we recur for right half.

Else (x is smaller) recur for the left half.

The Flowchart can be seen in the first attached image below:

Program listing:

// C++ program to implement recursive Binary Search

#include <bits/stdc++.h>

using namespace std;

// A recursive binary search function. It returns

// location of x in given array arr[l..r] is present,

// otherwise -1

int binarySearch(int arr[], int l, int r, int x)

{

   if (r >= l) {

       int mid = l + (r - l) / 2;

       // If the element is present at the middle

       // itself

       if (arr[mid] == x)

           return mid;

       // If element is smaller than mid, then

       // it can only be present in left subarray

       if (arr[mid] > x)

           return binarySearch(arr, l, mid - 1, x);

       // Else the element can only be present

       // in right subarray

       return binarySearch(arr, mid + 1, r, x);

   }

   // We reach here when element is not

   // present in array

   return -1;

}

int main(void)

{ int n,x;

cout<<"Size of array:\n";

cin >> n;

int arr[n];

cout<<"Enter array:\n";

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

{ cin >> arr[i]; }

cout<<"Enter element to be searched:\n";

cin>>x;

int result = binarySearch(arr, 0, n - 1, x);

   (result == -1) ? cout << "Element is not present in array"

                  : cout << "Element is present at index " << result;

   return 0;

}

The Sample test run of the program can be seen in the second attached image below.

Time(sec) :

0

Memory(MB) :

3.3752604177856

The Output:

Size of array:4

Enter array:10  20 30 40

Enter element to be searched:40

Element is present at index 3

Conclusions:

Time Complexity:

The time complexity of Binary Search can be written as

T(n) = T(n/2) + c  

The above recurrence can be solved either using Recurrence T ree method or Master method. It falls in case II of Master Method and solution of the recurrence is Theta(Logn).

Auxiliary Space: O(1) in case of iterative implementation. In case of recursive implementation, O(Logn) recursion call stack space.

8 0
3 years ago
Which of the following are the primary components used in machine learning? (Select Multiple Boxes)
valentina_108 [34]

The option that are the primary components used in machine learning are:

  • Option A) A machine learning model.
  • Option B) A model training algorithm.
  • Option C) A model inference algorithm.

<h3>What are the primary element used in machine learning?</h3>

The elements used in machine learning algorithm are::

  • Representation as it deals with  how the model looks like.
  • Evaluation deals with good models differentiation and evaluation.
  • Optimization deals with looking for good models.

Note that The option that are the primary components used in machine learning are:

  • Option A) A machine learning model.
  • Option B) A model training algorithm.
  • Option C) A model inference algorithm.

Learn more about machine learning from

brainly.com/question/25523571

#SPJ1

3 0
2 years ago
How is distributed ledger technology (DLT) used in a blockchain?
andrey2020 [161]

Answer:

I believe the answer is D. To keep records of transactions in different places.

Explanation:

3 0
3 years ago
Other questions:
  • True or false? The largest component of a database is a field.
    12·2 answers
  • What is the main difference between a literacy society and a digital Society
    9·1 answer
  • Why does Microsoft release new versions of its Windows operating system every few years?
    10·1 answer
  • Sensory cues are used for script writers to be able to get more creative with the story their are scripting for (i.e.
    15·1 answer
  • Which of the following combinations of keys is used as a short for saving a document on a computer
    5·1 answer
  • What would this look like if you were to write the pseudocode but for c++?
    5·1 answer
  • What is the "thinking work" of the computer? How does it help the computer?
    5·1 answer
  • A major retailer wants to enhance their customer experience and reduce losses
    6·1 answer
  • Show a parse tree and a leftmost derivation for : B = C * (A + B)
    12·1 answer
  • Explain why the scenario below fails to meet the definition of showrooming.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!