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
beks73 [17]
4 years ago
6

C#

Computers and Technology
1 answer:
ad-work [718]4 years ago
6 0

Answer:

Check the explanation

Explanation:

class AssemblyLine

{

// Builder uses a complex series of steps

//

public void Assemble(SandwichBuilder sandwichBuilder)

{

sandwichBuilder.AddMeats();

sandwichBuilder.AddSandwich Number();

sandwichBuilder.AddPrice();

sandwichBuilder.AddCalories();

}

}

class Sandwich

{

private string _sandwichType;

private Dictionary<string, string> _ingredients = new Dictionary<string, string>();

// Constructor

public Sandwich(string sandwichType)

{

this._sandwichType = sandwichType;

}

// Indexer

public string this[string key]

{

get { return _ingredients[key]; }

set { _ingredients[key] = value; }

}

public void Show()

{

Console.WriteLine("\n---------------------------");

Console.WriteLine("Sandwich: {0}", _sandwichType);

Console.WriteLine(" Meat: {0}", _ingredients["meat"]);

Console.WriteLine("Sandwich Number: {0}", _ingredients["sandwich Number"]);

Console.WriteLine(" Price: {0}", _ingredients["price"]);

Console.WriteLine(" Calories: {0}", _ingredients["calories"]);

}

}

abstract class SandwichBuilder

{

protected Sandwich sandwich;

// Gets sandwich instance

public Sandwich Sandwich

{

get { return sandwich; }

}

// Abstract build methods

public abstract void AddMeats();

public abstract void AddSandwich Number();

public abstract void AddPrice();

public abstract void AddCalories();

}

class TurkeyClub : SandwichBuilder

{

public TurkeyClub()

{

sandwich = new Sandwich("Turkey Club");

}

public override void AddMeats()

{

sandwich["meat"] = "Turkey";

}

public override void AddSandwich Number()

{

sandwich["sandwich Number"] = "10";

}

public override void AddPrice()

{

sandwich["price"] = "50";

}

public override void AddCalories()

{

sandwich["calories"] = "361";

}

}

/// <summary>

/// A ConcreteBuilder class

/// </summary>

class BLT : SandwichBuilder

{

public BLT()

{

sandwich = new Sandwich("BLT");

}

public override void AddMeats()

{

sandwich["meat"] = "Bacon";

}

public override void AddSandwich Number()

{

sandwich["sandwich Number"] = "2";

}

public override void AddPrice()

{

sandwich["price"] = "None";

}

public override void AddCalories()

{

sandwich["calories"] = "none";

}

}

/// <summary>

/// A ConcreteBuilder class

/// </summary>

class HamAndCheese : SandwichBuilder

{

public Ham()

{

sandwich = new Sandwich("Ham ");

}

public override void AddSandwhich Number()

{

sandwich["sandwhich number"] = "1";

}

public override void AddMeats()

{

sandwich["meat"] = "Ham";

}

public override void AddPrice()

{

sandwich["price"] = "None";

}

public override void AddCalories()

{

sandwich["calories"] = "none";

}

}

static void Main(string[] args)

{

SandwichBuilder builder;

// Create shop with sandwich assembly line

AssemblyLine shop = new AssemblyLine();

// Construct and display sandwiches

builder = new Ham();

shop.Assemble(builder);

builder.Sandwich.Show();

builder = new BLT();

shop.Assemble(builder);

builder.Sandwich.Show();

builder = new TurkeyClub();

shop.Assemble(builder);

builder.Sandwich.Show();

// Wait for user

Console.ReadKey();

}

You might be interested in
Using caller id is part of which step in an effective time management plan
timurjin [86]
The answer is avoid distractions.  <span>Using caller id is part of  step to avoid distractions in an effective time management plan.  </span><span>Today with caller ID available you can identify your callers. When you are focused on your task at hand and the time you have to accomplish it, you must learn to better control the telephone. </span>
5 0
4 years ago
In high-tech fields, industry standards rarely change.<br> True <br> False
Sophie [7]

Answer: false

Explanation:

5 0
3 years ago
Which business case is better solved by Artificial intelligence than conventional programming?<br>​
skad [1K]

Answer:

Predicting characteristics of high-value customers is the business case that better solved by Artificial intelligence than conventional programming.

Explanation:

Many corporations and businesses predict CLVs only by resembling at the total monetary expense of sales, without recognition circumstances. For instance, a customer who executes one big order might be less worthwhile than another consumer who purchases multiple occasions, but in more diminutive amounts.

4 0
3 years ago
Robots can work 24 hours a day, 365 days of the year, but human beings
statuscvo [17]

The word that best completes the sentence is:  "<em>can't</em>".
6 0
3 years ago
Read 2 more answers
jelaskan tiga kemungkinan sebab pengasah pensil itu tidak dapat berfungsi secara tiba-tiba (translate: explain three possible re
boyakko [2]

Explanation:

Internal gear wear must be significant (visually obvious) to be the cause of off-center sharpening. Cutter carrier is rotating but the pencil is not sharpening (doesn't feel like the cutter is engaging the pencil) This is usually caused by a foreign object (e.g., an eraser or broken pencil lead) inside the pencil bore.

3 0
3 years ago
Other questions:
  • Powerpoint assumes that the first slide in a new presentation is the
    10·1 answer
  • An app where you spin a wheel for coins and exchange for giftcards
    6·1 answer
  • How does a hard drive work?
    5·1 answer
  • If metal shims are used for alignment adjustment in the front, they adjust ________.
    5·1 answer
  • What are the text or graphics that are lighter than the main text located in a document's background called?
    10·1 answer
  • Light is a key formal element that film artists and technicians carefully manipulate to create mood, reveal character, and conve
    15·1 answer
  • What will the declaration below do to its target?
    9·1 answer
  • For the recursive method below, list the base case and the recursive statement, then show your work for solving a call to the re
    8·1 answer
  • Which spreadsheet feature could the scholarship committee use to locate applicants who meet the criteria?
    10·1 answer
  • In a computer-controlled greenhouse, a temperature sensor and a window motor are connected to the computer.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!