М
Молодежь
К
Компьютеры-и-электроника
Д
Дом-и-сад
С
Стиль-и-уход-за-собой
П
Праздники-и-традиции
Т
Транспорт
П
Путешествия
С
Семейная-жизнь
Ф
Философия-и-религия
Б
Без категории
М
Мир-работы
Х
Хобби-и-рукоделие
И
Искусство-и-развлечения
В
Взаимоотношения
З
Здоровье
К
Кулинария-и-гостеприимство
Ф
Финансы-и-бизнес
П
Питомцы-и-животные
О
Образование
О
Образование-и-коммуникации
Egorkalyadov03
Egorkalyadov03
28.07.2022 13:41 •  Информатика

Создайте класс с именем client (клиент), который описывает: фио, телефон, адрес. Опишите не меньше 2 конструкторов. Задайте свойства и метод, который выводит информацию о клиенте.

Создать класс customer (покупатель), который будет дочерним от client, добавить свойства: товар, стоимость, количество. Описать не менее 2 конструкторов, свойства. Задать метод определения стоимости заказанного товара. Переопределить метод вывода информации о клиенте.

Описать массив покупателей. Подсчитать общую сумму заказа.

👇
Ответ:
Anna200689898098654
Anna200689898098654
28.07.2022

Движок не позволяет добавить архив с проектом

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApp3

{

   class Program

   {

       public class client

       {

           public string FIO;

           public string phone;

           public string adress;

           public client()

           {

           }

           public client(string FIO, string phone, string adress)

           {

               this.FIO = FIO;

               this.phone = phone;

               this.adress = adress;

           }

           public client(client NewClient)

           {

               this.FIO = NewClient.FIO;

               this.phone = NewClient.phone;

               this.adress = NewClient.adress;

           }

           public string PoluchitInfo()

           {

               return "ФИО: " + this.FIO + "\nтелефон: " + this.phone + "\nадрес: " + this.adress;

           }

       }

       public class customer: client

       {

           public double Trovar;

           public int Kolichestvo;

           public double Stoimost;

           public customer()

           {

           }

           public customer(customer NewCostumer)

           {

               this.FIO = NewCostumer.FIO;

               this.phone = NewCostumer.phone;

               this.adress = NewCostumer.adress;

               this.Trovar = NewCostumer.Trovar;

               this.Kolichestvo = NewCostumer.Kolichestvo;

               this.Stoimost = NewCostumer.Stoimost;

           }

           public customer(string FIO, string phone, string adress, double Trovar, int Kolichestvo)

           {

               this.FIO = FIO;

               this.phone = phone;

               this.adress = adress;

               this.Trovar = Trovar;

               this.Kolichestvo = Kolichestvo;

               this.SchitatStoimost();

           }

           public double SchitatStoimost()

           {

               return Stoimost = Trovar * Kolichestvo;

           }

       }

       static void Main(string[] args)

       {

           customer[] customers = new customer[3];

           customers[0] = new customer("Иванов", "322223322", "Бобруйск", 1.1, 2);

           customers[1] = new customer("Петров", "123456789", "Урюпинск", 2.2, 5);

           customers[2] = new customer("Сидоров", "987654321", "Крыжополь", 3.3, 10);

           double Sum = 0;

           foreach(customer Temp in customers)

           {

               Console.WriteLine(Temp.PoluchitInfo()+"\n");

               Sum += Temp.Stoimost;

           }

           Console.WriteLine(Sum.ToString());

           Console.ReadLine();

       }

   }

}

4,8(63 оценок)
Открыть все ответы
Ответ:
nataliyadydina
nataliyadydina
28.07.2022
1)
var a:array [1..10] of integer;
      i,sum:integer;
begin
  randomize;
  sum:=0;
  for i:=1 to 10 do
    begin
      a[i]:=random(100)-50;
      write (a[i],' ');
      if a[i] < 0 then sum:=sum+a[i];  
    end;
  writeln;
  writeln ('Summa: ',sum);
  readln;
end.

2)
var a:array [1..10] of integer;
      i,max,index:integer;
begin
  for i:=1 to 10 do
    begin
       write ('A[',i,'] = ');
       readln (a[i]);
    end;
  max:=a[1];
  index:=1;
  for i:=2 to 10 do
    if a[i] > max then
      begin
        max:=a[i];
        index:=i;
      end;
  writeln ('Max: ',max,'.Index: ',index);
  readln;
end.

3)
var a:array [1..10] of integer;
      max,min,i,temp:integer;
begin
  randomize;
  for i:=1 to 10 do
    begin
       a[i]:=random(50);
       write (a[i],' ');
    end;
  writeln;
  max:=1;
  min:=1;
  for i:=2 to 10 do
    if a[i] > a[max] then max:=i else
      if a[i] < min then min:=i;
  writeln ('Max: ',a[max]);
  writeln ('Min: ',a[min]);
  temp:=a[min];
  a[min]:=a[max];
  a[max]:=temp;
  for i:=1 to 10 do write (a[i],' ');
end.
4,6(29 оценок)
Ответ:
hsjsjxn
hsjsjxn
28.07.2022
1)
var 
a: array [1..5] of integer;
i,k:integer;
Begin
Writeln('Перечислите элементы массива: ');For i:=1 to 5 do
read(a[i]);
For i:=1 to 5 do 
If (a[i] > -1) then write(a[i]:2);
End.
2)
var 
a: array [1..5] of integer;
i,k1,k2,max,min:integer;
Begin
min:=MaxInt;
max:=-MaxInt;
Writeln('Перечислите элементы массива: ');
For i:=1 to 5 do 
begin
read(a[i]);
if (a[i] > max) then max:=a[i];
if (a[i] < min) then min:=a[i];
end;
For i:=1 to 5 do 
begin
If (a[i] = max) then inc(k1);
If (a[i] = min) then inc(k2);
end;
If (k1>k2) then writeln('Больше max элементов') 
else writeln('Больше min элементов');
End.
3)
var 
a: array [1..5] of integer;
i,k,x:integer;
Begin
Write ('X = ');
read(x);
Writeln('Перечислите элементы массива: ');
For i:=1 to 5 do begin     read(a[i]);
if (a[i] = x ) then inc(k);
end;  
writeln('kol = ',k) ;
end.
4,5(12 оценок)
Это интересно:
Новые ответы от MOGZ: Информатика
logo
Вход Регистрация
Что ты хочешь узнать?
Спроси Mozg
Открыть лучший ответ