Design an application for the Sublime Sandwich Shop. The user makes sandwich order choices from list boxes, and the application displays the price. The user can choose from three main sandwich ingredients of your choice (for example, chicken) at three different prices. The user also can choose from three different bread types (for example, rye) from a list of at least three options. Save the file as JSandwich.java.

Answers

Answer 1

Answer: Provided in the explanation section

Explanation:

Using Code :-

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class SandwichShop

{

String sandwichIngredients [] = {"Chicken", "Mutton", "Veg"};

String breadTypes[] = {"Bloomer", "Cob", "Plait"};

JFrame jf;

JPanel p1, p2, p3, p4, mainP;

JList ingredient, bread;

JLabel ingL, breadL, amountL;

JTextField amountT;

JButton amountB, exitB;

SandwichShop()

{

jf = new JFrame("Sandwich Shop");

p1 = new JPanel();

p2 = new JPanel();

p3 = new JPanel();

p4 = new JPanel();

mainP = new JPanel();

ingredient = new JList<String>(sandwichIngredients);

bread = new JList<String>(breadTypes);

ingL = new JLabel("Select Sandwich Ingredients");

breadL = new JLabel("Select Bread Types");

amountL = new JLabel("Amount: ");

amountT = new JTextField(5);

amountB = new JButton("Check Amount");

exitB = new JButton("Exit");

p1.add(ingL);

p1.add(ingredient);

p2.add(breadL);

p2.add(bread);

p3.add(amountL);

p3.add(amountT);

p4.add(amountB);

p4.add(exitB);

mainP.add(p1);

mainP.add(p2);

mainP.add(p3);

mainP.add(p4);

mainP.setLayout(new GridLayout(4, 1));

jf.add(mainP);

jf.setVisible(true);

jf.setSize(400, 300);

exitB.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent ae)

{

System.exit(0);

}

});

amountB.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent ae)

{

int indexIngredient = ingredient.getSelectedIndex();

int indexBread = bread.getSelectedIndex();

if(indexIngredient == 0 && indexBread == 0)

amountT.setText("100");

if(indexIngredient == 0 && indexBread == 1)

amountT.setText("120");

if(indexIngredient == 0 && indexBread == 2)

amountT.setText("160");

if(indexIngredient == 1 && indexBread == 0)

amountT.setText("190");

if(indexIngredient == 1 && indexBread == 1)

amountT.setText("205");

if(indexIngredient == 1 && indexBread == 2)

amountT.setText("210");

if(indexIngredient == 2 && indexBread == 0)

amountT.setText("97");

if(indexIngredient == 2 && indexBread == 1)

amountT.setText("85");

if(indexIngredient == 2 && indexBread == 2)

amountT.setText("70");

}

});

}

public static void main(String[] args)

{

new SandwichShop();

}

}


Related Questions

Which of the following is an example of self-directed learning?

Answers

Answer:

Self directed learning is an the strategy the students guidance from that teacher decide and students they will learn.

Explanation:

Self directed learning its a effective technique that can anyone to use the learning in a school time into a curriculum program, there are many type of characteristics:- (1) Flexibility (2) Autonomy (3) Self acceptance (4) Playfulness.

Self directed learning is to perform that allow us to the initiative own learning, students grow and improve the motivation and integrity to the learning.Self directed learning to that contain the self learning with the internet program, and apply to the skill outside of the area learning.Self directed learning to the set of goal that the business and career and the achieve of the goal.Self directed learning to contain your  interests and motivate yourself and reflecting the learners.Self directed learning is to provide learn strategies and methods to achieve the better lives and behavior can translate.Self directed is the value to the teamwork and help the students and learner work in better team.Self learning is perform physical side learning and the focus on the mental side, and they we are putting in heads.Self learning is to contain the better your learning  standards and to measure learning goals.

Answer:

B

I got it on edge

________models software in terms similar to those that people use to describe real- world objects.
A) Procedural programming
B) Object-oriented programming
C) Object-oriented design
D) None of the above

Answers

Answer:

The correct answer is C - Object-oriented design.

Explanation:

Object-oriented design defines code or software as objects. These objects represent instances of a real-life situation. For example, an animal class consist of a dog, cat, lion. A dog therefore is n instance of the animal class.

Objects are described as having properties and behaviours. Properties are variables, arrays, sets, maps etc and behaviours are the functions and methods that manipulate these data.

Object-oriented programming is done based on this design.

E-mail is the most common distributed application that is widely used across all architectures and vendor platforms.a) trueb) false

Answers

Answer:

A. True.

Explanation:

E-mail is an acronym for electronic mail and it can be defined as an exchange or transmission of computer-based data (messages) from one user to another over a communications network system.

Also, a distributed application refers to a software program that is capable of running on several computer systems and can communicate effectively through a network.

E-mail is the most common distributed application that is widely used across all architectures and vendor platforms because it primarily operates on a client-server model, by providing users with the requested services through the Simple Mail Transfer Protocol (SMTP) using the standard port number of 25.

Show how the recursive multiplication algorithm computes XY, where X = 1234 and Y = 4321. Include all recursive computations.

Answers

Answer:

The result of recursive multiplication algorithm is 5332114 . Here karatsuba algorithm with recursive approach is used to compute XY where X = 1234 and Y = 4321.

Explanation:

The steps for karatsuba algorithm with recursive approach:

base case:

if(X<10) or (Y<10) then multiply X with Y

For example if X is 1 and Y is 2. Then XY = 1*2 = 2

Recursive case:

Now when the above if condition is not true then follow these steps to compute XY

Compute the size of numbers.

Notice that there are 4 digits in X i.e. 1 2 3 4 and a 4 digits in Y i.e. 4 3 2 1

So n = 4

Now divide the numbers in 2 parts as:

n/2 = 4/2 = 2

Since these are decimal numbers so we can write it as:

10^n/2

Now split the digits

X = 1234 is divided into 2 parts as:

12 and 34

Let a represent the first part and b represent the second part of X. So,

a = 12

b = 34

Y = 4321 is divided into 2 parts as:

43 and 21

Let c represent the first part and d represent the second part of Y. So,

c = 43

d = 21

Let multiplication reprsents the karatsuba recursive multiplication algorithm

Now recursively compute products of inputs of size n/2  

   multiplication (a, c)

   multiplication (b, d)

   multiplication (add(a, b), add(c, d))  

  Combine the above 3 products to compute XY  

As we know these decimal numbers have base 10 and X and Y are divided into two parts So X can be written as:

X = [tex]10^{\frac{n}{2} }[/tex]  a+b

Y can be written as:

Y = [tex]10^{\frac{n}{2} }[/tex]  c+d

Now compute XY as:

XY = ([tex]10^{\frac{n}{2} }[/tex]  a+b) ( [tex]10^{\frac{n}{2} }[/tex]  c+d)

XY = [tex]10^{\frac{2n}{2} }[/tex]  ac + [tex]10^{\frac{n}{2} }[/tex]  ad +  [tex]10^{\frac{n}{2} }[/tex]  bc + bd

     =  [tex]10^{n}[/tex]  ac + [tex]10^{\frac{n}{2} }[/tex] (ad + bc) + bd

Now put the values of n = 4, a = 12, b = 34 , c = 43 and d = 21

      = 10⁴ (12*43) + 10² (12*21 + 34*43) + (34*21)

      = 10⁴ (516) + 10² (252 + 1462) + 714

      = 10000*516 + 100*1714 + 714

      = 5160000 + 171400 + 714

XY  = 5332114

Hence the karatsuba multiplication algorithm with recursive appraoch computes XY = 5332114

What are video games and what have they meant for society?

Answers

video games are a source of entertainment for people especially children.

it helps relieve stress for adults or grown ups.

society sees video games as a negative impact on children and that it wastes their time.

Answer:

video games are games played for fun and enjoyment they are types of video games we have shooting video games, football video games, sport video games and so much more. video games are for fun and not all video games are meant for society. video games like football should be meant for sociey ehere everyone can come together to play games like these bring people and society together.

Add a new method to the Point class and change the attributes (x, y) to private from the above question: public double distance(Point next) This method returns the distance between the current Point object and the next Point object in the parameter. The distance between two points is the square root of the sum of the square of the differences of the x and y coordinates: square root of ( (x2 – x1)2 + (y2 – y1)2 ). (6 points) In the Point class, add private to int x and int y. You will have to modify the RefereceX.java and Point.java to deal with this change of modifier from the public to private. (6 points) Based the question 4 codes with the above additions, you should have the following results ( 3 points to display results) inside addTox(..): 14 14 7 9 14 3 inside addTox(..): 18 18 7 9 14 18 distance of p1 from origin is 14.142135623730951 distance of p2 from origin is 18.439088914585774 distance between p1 and p2 is = 4.47213595499958 Code: public class Point { int x; int y; // Constructs a new point with the given (x, y) location. // pre: initialX >= 0 && initialY >= 0 public Point(int initialX, int initialY) { this.x = initialX; this.y = initialY; } // Returns the distance between this point and (0, 0). public double distanceFromOrigin() { return Math.sqrt(x * x + y * y); } // Shifts this point's location by the given amount. // pre: x + dx >= 0 && y + dy >= 0 public void translate(int dx, int dy) { this.x += dx; this.y += dy; } public double distance(Point next) { //help } } public class ReferenceX { public static void main(String[] args) { int x = 7; int y = 9; Point p1 = new Point(1, 2); Point p2 = new Point(3, 4); addToX(x, p1); System.out.println(x + " " + y + " " + p1.x + " " + p2.x); addToX(y, p2); System.out.println(x + " " + y + " " + p1.x + " " + p2.x); } public static void addToX(int x, Point p1) { x += x; p1.x = x; System.out.println(" inside addTox(..): " + x + " " + p1.x); } }

Answers

Answer:

Following are the code to this question:

   public double distance(Point next) //defining distance method that accepts Constructor

   {

   int x1,x2,y1,y2;//defining integer variables

   double d;//defining double variable dis

   x1=this.x; //use x1 variable that use this keyword to store x variable value

   y1=this.y;//use y1 variable that use this keyword to store y variable value

   x2=next.x;//use x2 variable that use this keyword to store x variable value

   y2=next.y;//use y1 variable that use this keyword to store y variable value

   d=Math.sqrt((x1-0)*(x1-0) + (y1-0)*(y1-0));//use d variable that calculates distance between p1 to origin and store its value

   d=Math.sqrt((x2-0)*(x2-0) + (y2-0)*(y2-0));//use d variable that calculates distance between p2 to origin and store its value

   d=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));//calculating the distance from p1 to p2 and store its value

   return d;//return dis value

   }

Explanation:

In the above-given code, the double type method "distance" is defined, that accepts a constructor in its parameter, and inside the method, four integer variable "x1,x2,y1, and y2" and one double variable "d" is declared.  

After holding the value of x and y into the declared integer variable the "d" variable is used, that uses the maths square method with an integer variable, which holds p1 to origin value, p2 to origin value, and the distance from p1 to p2, and use the return keyword for return its value.

Network 10.10.10.0/24 needs to be broken up into eight equal sized networks. Including the first and last networks, what subnet mask will be needed?

Answers

Answer:

10.10.10.0/27 or 255.255.255.224

Explanation:

The network 10.10.10.0/24 has a default subnet mask of 255.255.255.0. To create eight equal sized networks, we have to take 3 bits from the host address to make subnets. The 3 bits is used to make 2³(8) subnets.

11111111.11111111.11111111.00000000  = 255.255.255.0 is the default subnet mask, if 3 bits is used to make subnets, the new subnet mask would be:

11111111.11111111.11111111.11100000 = 255.255.255.224

The subnet mask can also be represented as 10.10.10.0/27

Which of the following would not be considered metadata for a spreadsheet file?
A) Read-only attributeB) Calculation inside the fileC) Name of the fileD) Full size

Answers

Answer:

B.

Explanation:

Metadata is a type of data that dispense details of other data. In simple terms, metadata can be defined as information of a file such as file name, attributes, etc.

In excel sheet, metadata works the same and helps to provide information about file name, author name, file size, attributes such as read-only, archieve, hidden, system, location of the file, date and time of creation, modification, or accessed, type of file, etc.

From the given options, the information that is not considered or included in metadata is calculation inside the file. Metadata in excel sheet does not include calculations inside the file. Thus option B is the correct answer

True or False:
Input/output devices are capable of transferring information in only one direction.

Answers

Answer:

False

Explanation:

Input/output devices do NOT transfer information in only one direction.

Input devices receives the information while the output devices sends the information. The direction of the information being transferred between the input and output is NOT just in one direction.

Examples of input devices are keyboard, mouse, joy stick, scanner, etc.,

Examples of output devices are monitor (LED, LCD, CRT etc), printers (all types), plotters, projector, speaker(s), head phone, etc.






select the correct answers. What are examples of real-time applications?

Answers

My answer to the question are:online money transfer,news update,blog post.

Write an application that asks a user to enter an integer. Display a statement that indicates whether the integer is even or odd.

Answers

Answer:

in C++:

#include <iostream>

int main(){

int input;

std::cout<<"Enter a number: "<<std::endl;

std::cin>>input;

if(input%2==0){

std::cout<<" The number is even"<<std::endl;

}else{

std::cout<<"The number is odd"<<std::endl;

}

}

Explanation:

Getting user input as integer, and check if NUMBER÷2 have remainder=0 or no, if remainder==0 then number is even else number is odd

True or False) Embedded computers are standalone products that have many functions.

Answers

Your answer is false !

Embedded computers are standalone products that have many functions. The statement is false.

What is Embedded computers ?

An embedded computer is a type of computer that involves as part of a larger system, this computer performs a highly specific function like  industrial automation and in-vehicle computing, signage, robotics etc.

These computer platforms are used for a purpose-built for a single, software-controlled projects, used in a  device which perform that one singular function that they are programmed for.

The major differences between embedded computers and a regular  computer are it can find at the office lie in their purpose and design.

Embedded computers have the components arranged in a single  motherboard, with no room for expansion or upgradation is needed. They also come in a smaller size most of the time as compared to regular PCs.

Learn more about Embedded computers, on:

https://brainly.com/question/5113678

#SPJ2

the content of a text is its

Answers

Text content informs, describes, explains concepts and procedures to our readers

Write a GUI program that calculates the average of what an employee earns in tips per hour. The program’s window should have Entry (font: Courier New) widgets that let the user enter the number of hours they worked and amount they earned in tips during they time. When a Calculate button is clicked, the program should display the average amount they got paid in tips per hour. Use the following formula: Tips per hour = amount of tips in dollars / hours.

Answers

Answer:

Explanation:

Using Code:

from tkinter import *

#object of Tk class to make GUI

root = Tk()

#creating a canvas to put labels, entries and button

canvas1 = Canvas(root, width = 300, tallness = 200)

canvas1.pack()

#label for number of hours worked

label1 = Label(root, text = "Hours : ", textual style = ('Courier', 10))

canvas1.create_window(80, 50, window = label1)

#entry for number of hours worked

entry1 = Entry(root, textual style = ('Courier', 10))

canvas1.create_window(200, 50, window = entry1)

#label for sum they earned in tips

label2 = Label(root, text = "Tips : ", textual style = ('Courier', 10))

canvas1.create_window(80, 80, window = label2)

#entry for sum they earned in tips

entry2 = Entry(root, text style = ('Courier', 10))

canvas1.create_window(200, 80, window = entry2)

#label for tips every hour

label3 = Label(root, text = "Tips Per Hour : ", textual style = ('Courier', 10))

canvas1.create_window(80, 150, window = label3)

#function to figure tips every hour

def TipsPerHour():

#getting estimation of hour

hours = int(entry1.get())

#getting estimation of tips

tips = int(entry2.get())

#calculating normal sum got paid in tips every hour

normal = tips/hours

#creating a name to show normal

label4 = Label(root, text = "$" + str(average), textual style = ('Courier', 10))

canvas1.create_window(170, 150, window = label4)

#button for compute

calculateButton = Button(root, text = "Compute", textual style = ('Courier', 10), order = TipsPerHour)

canvas1.create_window(170, 110, window = calculateButton)

#mainloop

root.mainloop()

In troubleshooting a boot problem, what would be the point of disabling the quick boot feature in BIOS/UEFI setup?

Answers

Performs the process faster because it skips a check of the memory.

Write a recursive definition of x^n, where n≥0, similar to the recursive definition of the Fibonacci numbers. How does the recursion terminate?

Answers

Answer:

Following are the program to this question:

#include <iostream>//defining header file

using namespace std;

int recurs(int x, int n)//defining a method recurs that accepts two parameter

{

if(n==0)//defining if block that checks n value

{

return 1;//return value 1

}

else//defining else block

{

return x*recurs(x,n-1);//use return keyword that retun value

}

}

int main()//defining main method

{

cout<<recurs(5,3); //use print method to call recurs method

   return 0;

}

Output:

125

Explanation:

In the above-given program, the integer method "recurs" is declared which accepts, two integer variables, which are "x, n", inside the method the if conditional statement is used.

In the if block, it checks the value of n is equal to "0" if this condition is true, it will return a value, that is 1. Otherwise, it will go to the else block, in this block, it will use the recursive method to print its value.    

Recursions are functions that execute itself from within.

The recursive definition x^n in Python, where comments are used to explain each line is as follows:

#This defines the function

def recursion(x, n):

   #This returns 1, if n is 0

   if(n==0):

       return 1

   #This calculates the power recursively, if otherwise

   else:

       return x*recursion(x,n-1);

The function terminates when the value of n is subtracted till 0

Read more about recursions at:

https://brainly.in/question/634885

Which item converts a high level language program to low level machine instruction?

Answers

The compiler translates each source code instruction into the appropriate machine language instruction, an

To move a file or folder in Microsoft Windows you can click and hold down the left mouse button while moving your mouse pointer to the location you want the file or folder to be, which is also known as

Answers

Answer:

**UNSURE** Cutting and pasting*

Explanation:

Its essentially the same thing. Nowadays File Explorer will instead copy the file to the new location in certain circumstances, such as if the destination is a separate drive.

*I'm not sure if this is the type of answer you are looking for, as I'm not sure what context this is in. If you're looking for a specific term regarding that type of action in the user interface, this might not be it.

Which of these file types does not share info in a spreadsheet?
A) CSV
B) Excel
C) PNG
D) all have

Answers

Answer:

C) PNG

Explanation:

PNG which is an acronym for Portable Network Graphics is a form of images file format and it does not share info in a spreadsheet. The files that share info on the spreadsheet are the following:

1. Text = .txt

2. Formatted Text = .prn

3. CSV = .csv

4. Data Interchange Format = .dif

5. Symbolic Link = .slk

6. Web page = .html, .htm

7. XML Spreadsheet = .xml

Hence, in this case, the file types that do not share info in a spreadsheet is PNG

PNG does not share info in a spreadsheet

Comma-separated values (CSV) file is a text file that stores data in lines. Each record is separated by commas and is made up of fields. CSV can store data in tabular forms like spreadsheet or database.

Excel files use a Binary Interchange File Format that store data like numbers, formula and spreadsheet data.

Portable Graphics Format (PNG) is a file format that is used to store images. It does not share info in spreadsheet.

Find about more at: https://brainly.com/question/17351238

Create a File: Demonstrate your ability to utilize a Linux command to create a text file. Create this file in the workspace directory: in. A text file showing the current month, day, and time (Title thisfile Time_File.txt.) II. Create a Directory: In this section of your project, you will demonstrate your ability to execute Linux commands to organize the Linux directory structure. a. In the workspace directory, create a new directory titledCOPY. III. Modify and Copy: Demonstrate your ability to utilize Linux commands to copy a file to a different directory and renameit. a. Copy the Time_File.txt file from the workspace directory to the COPYdirectory. b. Append the word COPY to the filename. IV. Execute the Script: Complete and execute the newly created script.

Answers

Answer: Provided in the explanation section

Explanation:

#So we Create a workspace directory

mkdir workspace

#let us browse inside the workspace

cd workspace/

#creating a Time_File.txt file

touch Time_File.txt

#confirming creation of Time_File.txt

ls

# Time_File.txt

#writing in the month day and time to Time_File.txt

date +%A%B%R >> Time_File.txt

#Let us confirm the content of Time_File.txt as month day and time

cat Time_File.txt

# ThursdayJune19:37

#making a COPY directory

mkdir COPY

#verifying creation of COPY

ls

# COPY Time_File.txt

# copying Time_File.txt to COPY

cp Time_File.txt COPY/

#check the inside COPY

cd COPY/

#verifying copying of Time_File.txt to COPY

ls

# Time_File.txt

#appending COPY to Time_File.txt name

mv Time_File.txt COPYTime_File.txt

#confirming append

ls

# COPYTime_File.txt

# Creating a NewScript.sh

touch NewScript.sh

# cocnfirming the function

ls

# COPYTime_File.txt NewScript.sh

# adding executable permission

chmod +x NewScript.sh

ls

COPYTime_File.txt NewScript.sh

# Running NewScript.sh

./NewScript.sh

# Time_File.txt

# ThursdayJune19:49

# COPY Time_File.txt

# Time_File.txt

# COPYTime_File.txt

# we repeat same as seen above using script

ls

# COPYTime_File.txt NewScript.sh workspace

The most common type of monitor for a laptop or desktop is a

Answers

Liquid Clear Display

Answer:

LCD monitor

explanation

it incorporates one of the most advanced technologies available today.

What three conditions must be satisfied in order to solve the critical section problem?

Answers

Answer:

Explanation:

The critical section problem revolves around trying to ensure that at most one process is executing its critical section at a given time. In order to do so, the three following conditions must be met.

First, no thread may be executing in its critical section if there is already a current thread executing in its critical section.

Second, only the specific threads that are not currently occupied executing in their critical sections are allowed to participate in deciding which process will enter its critical section next.

Third, a preset limit must exist on the number of times that other threads are allowed to enter their critical state after a thread has made a request to enter its critical state.

Which type of virus includes protective code that prevents outside examination of critical elements?

Answers

Answer:

Armoured viruses

Explanation:

Armoured viruses are computer viruses that have been found to be very dangerous, Armoured viruses ar designed to protect itself against any attempt to detect or trace Its activities. They have different ways through which they bypass antivirus software applications in a computer system, making it very difficult to eliminate from an infected system.

With enormous demands for processing power, ______matters more than ever in transforming enterprises into digital businesses.
a. hardware.
b. software.
c. mobile apps.
d. social network.

Answers

Answer:

a. hardware.

Explanation:

The hardware is the physical component of the computer. The processing power of a computer is dependent on the nature and type of its processor. The processor is a part of the hard ware of the computer, primarily the Central Processing Unit. Therefore, with enormous demands for processing power, hardware matters more than ever in transforming enterprises into digital business.

The Security Configuration Wizard saves any changes that are made as a __________ security policy which can be used as a baseline and applied to other servers in the network.

Answers

Complete Question:

The Security Configuration Wizard saves any changes that are made as a __________ security policy which can be used as a baseline and applied to other servers in the network.

Group of answer choices

A. user- or server-specific

B. port- or program-specific

C. role- or function-specific

D. file or folder-specific

Answer:

C. role- or function-specific.

Explanation:

The Security Configuration Wizard (SCW) was first used by Microsoft in its development of the Windows Server 2003 Service Pack 1. The main purpose of the SCW is to provide guidance to network administrators, secure domain controllers, firewall rules and reduce the attack surface on production servers.

Generally, The Security Configuration Wizard saves any changes that are made as a role- or function-specific security policy which can be used as a baseline and applied to other servers in the network.

After a network administrator checks the Group policy, any changes made as a role- or function-specific security policy by the Security Configuration Wizard (SCW) is used as a baseline and can be applied either immediately or sometimes in the future to other servers in the network after it has been tested in a well secured environment.

Additionally, the Microsoft Security Configuration Wizard (SCW) assist administrators in running the following;

1. Network and Firewall Security settings.

2. Auditing Policy settings.

3. Registry settings.

4. Role-Based Service Configuration.

Write code to complete factorial_str()'s recursive case. Sample output with input: 5 5! = 5 * 4 * 3 * 2 * 1 = 120

Answers

Answer:

Here is the complete code to complete factorial_str()'s recursive case:

Just add this line to the recursive part of the code for the solution:

output_string += factorial_str(next_counter,next_value)  

The above statement calls factorial_str() method recursively by passing the values of next_counter and next_value. This statement continues to execute and calls the factorial_str() recursively until the base case is reached.

Explanation:

Here is the complete code:

def factorial_str(fact_counter, fact_value):  #method to find the factorial

   output_string = ''   #to store the output (factorial of an input number)

   if fact_counter == 0:  # base case 1 i.e. 0! = 1

       output_string += '1'  # displays 1 in the output

   elif fact_counter == 1:  #base case 2 i.e. 1! = 1

       output_string += str(fact_counter) + ' = ' + str(fact_value)  #output is 1

   else:  #recursive case

       output_string += str(fact_counter) + ' * '  #adds 8 between each value of fact_counter

       next_counter = fact_counter - 1  #decrement value of fact_counter by 1

       next_value = next_counter * fact_value  #multiplies each value of fact_value by next_counter value to compute the factorial

       output_string += factorial_str(next_counter,next_value) #recursive call to factorial_str to compute the factorial of a number

   return output_string   #returns factorial  

user_val = int(input())  #takes input number from user

print('{}! = '.format(user_val),end="")  #prints factorial in specified format

print(factorial_str(user_val,user_val))  #calls method by passing user_val to compute the factorial of user_val

I will explain the program logic with the help of an example:

Lets say user_val = 5

This is passed to the method factorial_str()

factorial_str(fact_counter, fact_value) becomes:

factorial_str(5, 5):  

factorial_str() method has two base conditions which do not hold because the fact_counter is 5 here which is neither 1 nor 0 so the program control moves to the recursive part.

output_string += str(fact_counter) + ' * '  adds an asterisk after the value of fact_counter i.e. 5 as:

5 *

next_counter = fact_counter - 1 statement decrements the value of fact_counter  by 1 and stores that value in next_counter. So

next_counter = 5 - 1

next_counter = 4

next_value = next_counter * fact_value  multiplies the value of next_counter by fact_value and stores result in next_value. So

next_value = 4 * 5

next_value = 20

output_string += factorial_str(next_counter,next_value)  this statement calls the factorial_str() to perform the above steps again until the base condition is reached. This statement becomes:

output_string = output_string + factorial_str(next_counter,next_value)

output_string = 5 * 4 = 20

output_string = 20

Now factorial_str(next_counter,next_value) becomes:

factorial_str(4,20)

output_string += str(fact_counter) + ' * ' becomes

5 * 4 * 3

next_counter = fact_counter - 1  becomes:

4 - 1 = 3

next_counter = 3

next_value = next_counter * fact_value  becomes:

3 * 20 = 60

next_value = 60

output_string = 5 * 4 * 3= 60

output_string = 60

factorial_str(next_counter,next_value) becomes:

factorial_str(3,60)

output_string += str(fact_counter) + ' * ' becomes

5 * 4 * 3 * 2

next_counter = fact_counter - 1  becomes:

3 - 1 = 2

next_counter = 2

next_value = next_counter * fact_value  becomes:

2 * 60 = 120

next_value = 120

output_string += factorial_str(next_counter,next_value) becomes:

output_string = 120 + factorial_str(next_counter,next_value)

output_string = 5 * 4 * 3 * 2 = 120

factorial_str(2,120)

output_string += str(fact_counter) + ' * ' becomes

5 * 4 * 3 * 2 * 1

next_counter = fact_counter - 1  becomes:

2 - 1 = 1

next_counter = 1

next_value = next_counter * fact_value  becomes:

1 * 120 = 120

next_value = 120

output_string += factorial_str(next_counter,next_value) becomes:

output_string = 120 + factorial_str(next_counter,next_value)

factorial_str(next_counter,next_value) becomes:

factorial_str(1, 120)

Now the base case 2 evaluates to true because next_counter is 1

elif fact_counter == 1

So the elif part executes which has the following statement:

output_string += str(fact_counter) + ' = ' + str(fact_value)  

output_string = 5 * 4 * 3 * 2 * 1 = 120

So the output of the above program with user_val = 5 is:

5! = 5 * 4 * 3 * 2 * 1 = 120

Following are the recursive program code to calculate the factorial:

Program Explanation:

Defining a method "factorial_str" that takes two variable "f, val" in parameters.Inside the method, "s" variable as a string is defined, and use multiple conditional statements.In the if block, it checks f equal to 0, that prints value that is 1.In the elif block, it checks f equal to 1, that prints the value is 1.In the else block, it calculates the factor value and call the method recursively, and return its value.Outside the method "n" variable is declared that inputs the value by user-end, and pass the value into the method and print its value.

Program:

def factorial_str(f, val):#defining a function factorial_str that takes two parameters

   s = ''#defining a string variable

   if f == 0:#defining if block that check f equal to 0

       s += '1'#adding value in string variable

   elif f == 1:#defining elif block that check f equal to 1

       s += str(f) + ' = ' + str(val)#printing calculated factorial value

   else:#defining else block that calculates other number factorial

       s += str(f) + ' * '#defining s block that factorial

       n = f - 1#defining n variable that removes 1

       x = n * val#defining x variable that calculate factors

       s += factorial_str(n,x)#defining s variable that calls factorial_str method recursively  

   return s#using return keyword that returns calculated factors value  

n = int(input())#defining n variable that inputs value

print('{}! = '.format(n),end="")#using print method that prints value

print(factorial_str(n,n))#calling method factorial_str that prints value

Output:

Please find the attached file.

Learn more:

brainly.com/question/22777142

What AI technology is commonly used to describe Input A to Output B mappings?

Answers

Answer:

Supervised learning

Explanation:

Supervised learning is a term widely used in computer engineering that describes a form of the machine learning process, which is based on understanding a task that maps an input to an output based on illustration input A to output B pairs.

Hence, in this case, AI technology that is commonly used to describe Input A to Output B mappings is called SUPERVISED LEARNING

In order to place a gradient within a stroked path for type, one must convert the type using the __________

Answers

Answer:

in order to place a gradient within a stroked path for type ,one must convert the type 17316731

11. To select Access database entries, you should be in
O A. Datasheet view.
O B. Design view.
O C. Query wizard.
O D. Form Design.

Answers

Answer: A

Explanation:

Answer:

Design view

Explanation:

did it on edge

Today, trending current events are often present on websites. Which of the following early developments in audiovisual technology is most closely related to this?

Answers

Answer: Newsreels

Explanation:

Options not included however with the early audio visual technologies known, the Newsreel is the closest when it comes to displaying news and current events.

Like the name suggests, Newsreels showed news and they did this of events around the world. They were short films that captured events and then displayed them in cinemas and any other viewing locations capable of showing them.

By this means, people were able to keep up to date with events around the world without having to read newspapers. The advent of news channels killed this industry and logically so.

Answer:

B: Newsreels

Explanation:

edg2021

The text states, "...newsreels began to gain popularity. They were short movies about current events around the world, usually shown prior to the main feature in movie theaters"

Other Questions
Obtain a box of breakfast cereal and read the list of ingredients. What are four chemicals from the list ASAP Find the measure of the third angle of a triangle if the measures of the other two angles are given. 118.6 and 42.3 A. 19.1 B. 36.7 C. 39.1 D. 29.1 10. What century was the year AD 222 a part of? How you collect information on your customers and use that information to get your customers to buy your product/service is called? a Selling b Marketing Information Management c Market Planning d Channel Management square root of 12544 in division method Does the text contain a vague pronoun reference? At the conference, the authors met with some publishers to discuss their new books. Name at least three fundamental differences between the harmonic oscillator dynamics and the simple pendulum dynamics so i need help with a question its a scientific can become a theory A golf ball has a diameter of 1.6 cubic inches. How many golf balls will fit inside of a storage unit that is 10 feet wide, 20 feet long, and 8 feet high? (Volume of a sphere = 4/3 r3 1291962 balls 1291962 balls 2764800 balls Read the passage. This edition of the Columbus letter, printed in Basel in 1494, is illustrated. The five woodcuts, which supposedly illustrate Columbuss voyage and the New World, are in fact mostly imaginary, and were probably adapted drawings of Mediterranean places. This widely published report made Columbus famous throughout Europe. It earned him the title of Admiral, secured him continued royal patronage, and enabled him to make three more trips to the Caribbean, which he firmly believed to the end was a part of Asia. Seventeen editions of the letter were published between 1493 and 1497. Only eight copies of all the editions are extant. "Columbuss Voyage and the New World, Library of Congress Whose point of view is represented in the passage? Students going on field trip noticed that boys from the football team were able to walk for a long time without getting tired while other students got tired easily......what would be the hypothesis to that? A painting of a Mexican woman wearing a lace hood around her face. Name the artist of the painting above. Describe the image, including how the gender of the artist influenced the piece. Which statement is best supported by the dialogue? Grandpa is upset because they removed the money from his boots. Grandpa believes that it is time to begin preparing for his death. Mom offends Grandpa when she scolds him about the money. Mom is angry that Grandpa came to her home uninvited. Noah is in the process of getting organized. Which of the following actions should he take during this time? Check all that apply.A. Noah should inform his employees of the activities he wants them to do for him.B. Noah should put all of his important projects into a calendar that he looks at every day.C. Noah should get to work and take action on all of his organized projects and commitments.D. Noah should write down a list of all of the actions he needs to take so that he will have a reminder of what he needs to do when he needs to do it. (M^3/ k^4) ^ -5Plzzz answer this question its urgent find a if given c and write a letter to your uncle abroad, asking him to help you with some items you need for your schooling. Which one of the following statements about best practices is false? a. Because using best practice methodology to perform an activity produces superior outcomes, those outcomes serve as a benchmark or standard for determining how well a particular organization performs that activity. b. The more that a company's organizational units use best practices in performing their work, the closer the company moves toward performing its value chain activities more effectively and efficiently. c. Implementing use of a best practice involves radically redesigning and streamlining how an activity is performed, with the intent of achieving quantum improvements in performance. d. A best practice can evolve over time as improvements are discovered. e. Normally, the best practices utilized by other organizations have to be adapted to fit the specific circumstances of a company's own business and operating requirements. Please help. I will mark brainliest. There are 30 calories in cup of red seedless grapes. How many calories are consumed if a person eats between and 1 cups of grapes?