Drawing application | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Drawing application

Please help

31st Jan 2021, 7:29 AM
Thakkar Heer
Thakkar Heer - avatar
39 Answers
+ 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"); } } }
7th Mar 2021, 8:41 PM
Sachin Kumar Biswal
Sachin Kumar Biswal - avatar
+ 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.
31st Jan 2021, 8:49 AM
A͢J
A͢J - avatar
+ 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"); } } }
7th Nov 2021, 11:21 PM
ANGEL ALEJANDRO MONTIEL ALONSO
ANGEL ALEJANDRO MONTIEL ALONSO - avatar
+ 1
Thakkar Heer Make code in Code Playground and share the link here so I can debug your problem.
31st Jan 2021, 8:44 AM
A͢J
A͢J - avatar
31st Jan 2021, 9:09 AM
Arsenic
Arsenic - avatar
0
This is the code provided by SL and you need to complete by adding some code. So where is your attempts?
31st Jan 2021, 7:37 AM
A͢J
A͢J - avatar
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 }
31st Jan 2021, 7:39 AM
Thakkar Heer
Thakkar Heer - avatar
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.
31st Jan 2021, 7:44 AM
A͢J
A͢J - avatar
0
Please help
31st Jan 2021, 8:25 AM
Thakkar Heer
Thakkar Heer - avatar
0
How to do that
31st Jan 2021, 8:45 AM
Thakkar Heer
Thakkar Heer - avatar
0
Please tell
31st Jan 2021, 8:46 AM
Thakkar Heer
Thakkar Heer - avatar
0
😭😭
31st Jan 2021, 8:46 AM
Thakkar Heer
Thakkar Heer - avatar
0
Please please
31st Jan 2021, 8:47 AM
Thakkar Heer
Thakkar Heer - avatar
31st Jan 2021, 9:13 AM
Thakkar Heer
Thakkar Heer - avatar
0
Thanks for helping and now please fix it please
31st Jan 2021, 9:14 AM
Thakkar Heer
Thakkar Heer - avatar
0
Thank you so so so much
31st Jan 2021, 9:56 AM
Thakkar Heer
Thakkar Heer - avatar
0
I passed it thankyou
31st Jan 2021, 9:56 AM
Thakkar Heer
Thakkar Heer - avatar
0
Can you help me in the problem robot- barmen
31st Jan 2021, 10:00 AM
Thakkar Heer
Thakkar Heer - avatar
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 () { } } } }
31st Jan 2021, 10:00 AM
Thakkar Heer
Thakkar Heer - avatar