Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an application in C# named TestClassifiedAd that instantiates and display

ID: 3592841 • Letter: C

Question

Create an application in C# named TestClassifiedAd that instantiates and displays a ClassifiedAd object. A ClassifiedAd has fields for a category (for example, Used Cars), a number of words and a price. Include properties that contain get and set accessors for the category and number of words, but only a get accessor for the price. The price is calculated at nine cents per word. Also

Class ClassifiedAd implements:

A constructor which defines two parameters: category and word count

Two read-only auto-implemented properties: category and word count. The constructor assigns values to these two properties

One read-only property, which calculates the price of the classified advertisement

Application class TestClassifiedAd implements one method which defines a parameter of type ClassifiedAd. The method is responsible for displaying the details related to the classified advertisement entered by the user.

Explanation / Answer

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

/*C program to design love calculator.*/

#include <stdio.h>

#include <string.h>

#include <ctype.h>

//function will return sum of all digits

int sumOfDigits(int num)

{

    int sum=0;

    while(num>0)

    {

        sum+=(num%10);

        num/=10;

    }

    return sum;

}

int main()

{

    char yName[40], pName[40];

    int sum, sum1, i, choice;

    float perc=0;

    do

    {

        printf("Enter your name: ");

        fflush(stdin);

        gets(yName);

        printf("Enter your partner's name: ");

        fflush(stdin);

        gets(pName);

        sum=0;

        for(i=0;i<(strlen(yName));i++)

        {

            sum+=tolower(yName[i]);

        }

        sum1=0;

        for(i=0;i<(strlen(yName));i++)

        {

            sum1+=tolower(pName[i]);

        }

        perc=(sumOfDigits(sum)+sumOfDigits(sum1))+40;

        if(perc>100) perc=100;

        printf("Your love percentage is: %.02f ",perc);

        printf("Want to calculate with some one else (0 to exit, 1 to continue) ???: ");

        scanf("%d",&choice);

    }while(choice!=0);

    return 0;

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

/*C program to design love calculator.*/

#include <stdio.h>

#include <string.h>

#include <ctype.h>

//function will return sum of all digits

int sumOfDigits(int num)

{

    int sum=0;

    while(num>0)

    {

        sum+=(num%10);

        num/=10;

    }

    return sum;

}

int main()

{

    char yName[40], pName[40];

    int sum, sum1, i, choice;

    float perc=0;

    do

    {

        printf("Enter your name: ");

        fflush(stdin);

        gets(yName);

        printf("Enter your partner's name: ");

        fflush(stdin);

        gets(pName);

        sum=0;

        for(i=0;i<(strlen(yName));i++)

        {

            sum+=tolower(yName[i]);

        }

        sum1=0;

        for(i=0;i<(strlen(yName));i++)

        {

            sum1+=tolower(pName[i]);

        }

        perc=(sumOfDigits(sum)+sumOfDigits(sum1))+40;

        if(perc>100) perc=100;

        printf("Your love percentage is: %.02f ",perc);

        printf("Want to calculate with some one else (0 to exit, 1 to continue) ???: ");

        scanf("%d",&choice);

    }while(choice!=0);

    return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote