Question Drawing Application problem. try to answer this.

tjawe

New member
Joined
Jan 21, 2021
Messages
1
Programming Experience
Beginner
You are creating a drawing application and currently have only 1 tool - a pencil. You want to add brush and spray to the drawing toolbar.
The program you are given declares an IDraw interface with the StartDraw() method, and class Draw, which performs pencil drawing by implementing the IDraw interface. It outputs "Using pencil".
Complete the given Brush and Spray classes by
- inheriting them from class Draw
- implementing the StartDraw() method for each tool, in order to output
"Using brush" for Brush, or
"Using spray" for Spray.

The Draw objects and their method calls are provided in Main().

C#:
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
    }
    //inherit this class from the class Draw
    class Spray
    {
        //implement the StartDraw() method
    }
}
 
Last edited by a moderator:

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
2,583
Location
Chesapeake, VA
Programming Experience
10+
Unfortunately, we are not a code writing service. We will be happy to help you if you tell us what problems your are running into. Currently it looks like you have not even put in any effort to try to solve the problem on your own.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,554
Location
Sydney, Australia
Programming Experience
10+
Even more than what @Skydiver said, it's not for us to cheat for you. This is obviously homework and not just some personal project so you can either do the work or you can't and, if you can't, you don't get the marks. It's not for us to do your work for you while others put in the effort to do their own work and get fewer marks. Do what you can and then specify EXACTLY how and where you're stuck and then we can help you to solve your problem. If you don't even know what problem you're trying to solve, though, then there's nothing for us to help with.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
2,583
Location
Chesapeake, VA
Programming Experience
10+
The answer to this is for the OP to show some effort towards solving the problem, then they can say what problem are they running into, and then we can walk them through trying to solve that issue.
 
Top Bottom