+ 2
Drawing application
Please help
39 odpowiedzi
+ 37
using System;
using System.Collections.Generic;
namespace Code_Coach_Challenge
{
class Program
{
static void Main(string[] args)
{
Draw pencil = new Draw();
Draw brush = new Brush();
Draw spray = new Spray();
pencil.StartDraw();
brush.StartDraw();
spray.StartDraw();
}
}
/*
Draw => "Using pencil"
Brush => "Using brush"
Spray => "Using spray"
*/
public interface IDraw
{
void StartDraw();
}
class Draw : IDraw
{
public virtual void StartDraw()
{
Console.WriteLine("Using pencil");
}
}
//inherit this class from the class Draw
class Brush:Draw
{
//implement the StartDraw() method
public override void StartDraw()
{
Console.WriteLine("Using brush");
}
}
//inherit this class from the class Draw
class Spray:Draw
{
//implement the StartDraw() method
public override void StartDraw()
{
Console.WriteLine("Using spray");
}
}
}
+ 2
Thakkar Heer
Go in Code section select C# language post code there and save your code. Then at top write corner there will be share option. Copy the link and share here.
+ 2
using System;
using System.Collections.Generic;
namespace Code_Coach_Challenge
{
class Program
{
static void Main(string[] args)
{
Draw pencil = new Draw();
Draw brush = new Brush();
Draw spray = new Spray();
pencil.StartDraw();
brush.StartDraw();
spray.StartDraw();
}
}
/*
Draw => "Using pencil"
Brush => "Using brush"
Spray => "Using spray"
*/
public interface IDraw
{
void StartDraw();
}
class Draw : IDraw
{
public virtual void StartDraw()
{
Console.WriteLine("Using pencil");
}
}
//inherit this class from the class Draw
class Brush:Draw
{
//implement the StartDraw() method
public override void StartDraw()
{
Console.WriteLine("Using brush");
}
}
//inherit this class from the class Draw
class Spray:Draw
{
//implement the StartDraw() method
public override void StartDraw()
{
Console.WriteLine("Using spray");
}
}
}
+ 1
Thakkar Heer
Make code in Code Playground and share the link here so I can debug your problem.
+ 1
0
This is the code provided by SL and you need to complete by adding some code. So where is your attempts?
0
using System;
using System.Collections.Generic;
namespace Code_Coach_Challenge
{
class Program
{
static void Main(string[] args)
{
Draw pencil = new Draw();
Draw brush = new Brush();
Draw spray = new Spray();
pencil.StartDraw();
brush.StartDraw();
spray.StartDraw();
}
}
/*
Draw => "Using pencil"
Brush => "Using brush"
Spray => "Using spray"
*/
public interface IDraw
{
void StartDraw();
}
class Draw : IDraw
{
public virtual void StartDraw()
{
Console.WriteLine("Using pencil");
}
}
//inherit this class from the class Draw
class Brush
{
//implement the StartDraw() method
interface Brush
}
//inherit this class from the class Draw
class Spray
{
//implement the StartDraw() method
interface Spray
}
0
Thakkar Heer
You need to learn about the use of class and interface. This is not the right way to implement interface.
You need to implement interface on class Brush and Spray as like implemented in Draw class.
0
Please help
0
How to do that
0
Please tell
0
😭😭
0
Please please
0
Thanks for helping and now please fix it please
0
Thank you so so so much
0
I passed it thankyou
0
Can you help me in the problem robot- barmen
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
try
{
int drinks = Convert.ToInt32(Console.ReadLine());
int shelves = Convert.ToInt32(Console.ReadLine());
//your code goes here//
float r = drinks / shelves;
Console.WriteLine(r);
float r = drinks / shelves;
if (drinks == 30 || drinks == 10)
Console.WriteLine(r);
else Console.WriteLine(shelves);
Console.WriteLine("At least 1 shelf");
}
/*
* 1. DivideByZeroException => "At least 1 shelf"
* 2. FormatException => "Please insert an integer"
*/
type catch ()
{
}
catch ()
{
}
}
}
}