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

Have a pizza ordering page in which you ask the user for the size of pizza they

ID: 675340 • Letter: H

Question

Have a pizza ordering page in which you ask the user for the size of pizza they would like. You may keep the same options as you had for assignment #5: personal = $6, medium = $9, large = $12.  However, include an additional option for extra large: $16.  Also have a select box for number of drinks with options for 0, 1, 2, 3, 4.  Each drink costs $1.  Finally have a select box for number of desserts, also with options between 0 and 4.  Each dessert costs $3.  When the user submits their order, output the total cost of their order. So if they ordered a large pizza ($12) plus two drinks (2 * $1 =  $2.00) plus two desserts (2*$2 = $6.00), you would output their total cost as being $20. In the output statement, also indicate the time/date of their order. You may use the ‘Date()’ function to do so.  You may output using an alert ordocument.write. Bonus up to 5 points: Instead of the complete (and fairly long) date, output only the month (as a number is fine), day (of the month), and time (not including seconds). So your output statement might look something like:  We received your order on 5/3 at 15:32. Your total cost is $20.

Explanation / Answer

#include<stdio.h>

002

#include<conio.h>

003

004

void firstPage();               // method which prints the first page

005

006

void menuPage();                // method which prints menu after first page

007

008

void pizzaPage(float p[20], char *itm[20], int k); // pizzapage if pizza is

009

                                                    // selected from menu

010

                                                    // page..variables which

011

                                                    // will

012

                          // store selected item name and their cost are

013

                          // passed as arguments..

014

015

void sidesPage(float p[20], char *itm[20], int k); // if sides is selected

016

                                                    // from menu page

017

018

void drinksPage(float p[20], char *itm[20], int k); // if drinks is selected

019

                                                    // from menu page

020

021

void orderListPage(float p[20], char *itm[20], int k); // method to display

022

                                                        // the order being

023

                                                        // placed

024

                        // will extract price and item names from

025

                        // arrays whose reference are passed as

026

                        // arguments..last index for arrays is k

027

028

void exitPage();                // method which prints the exiting message

029

030

031

int main()

032

{

033

    char i = 0;

034

    float price[20];            // to store the prices of selected items

035

    char *item[20];             // to store the name of selected item

036

    int k = 0;                  // to store the total no of items ordered yet

037

    // it will also act as a pointer to the arrays price n item

038

039

    firstPage();                // first page displayed

040

    getch();                    // will continue only when some key is pressed

041

042

    while (i != '5')

043

    {                           // i==5 is exiting situation

044

        menuPage();             // menu displayed

045

046

        printf(" Please Enter Your Selection <y/n>:");

047

        scanf("%c", &i);        // choice received in char i

048

049

        // this loop will be repeated until a valid choice comes

050

        while (i != '1' && i != '2' && i != '3' && i != '4' && i != '5')

051

        {

052

            menuPage();

053

            printf(" Please Enter Valid Selection : ");

054

            scanf("%c", &i);

055

        }

056

057

        // switch for valid choice received in i

058

        switch (i)

059

        {

060

            // pizza is choosed

061

        case '1':

062

            {

063

                // this method will display pizza choices as well as will

064

                // receive order and will update arrays price and item

065

                // accordingly..k will have the index for next updation

066

                pizzaPage(price, item, k);

067

                break;

068

            }

069

070

071

            // sides is choosed

072

        case '2':

073

            {

074

                // similarly like pizzapage,this will display sides choices

075

                // and will place the order in arrays,will update k

076

                sidesPage(price, item, k);

077

                break;

078

            }

079

080

081

            // drinks is choosed from menu page

082

        case '3':

083

            {

084

                // same as above

085

                drinksPage(price, item, k);

086

                break;

087

            }

088

089

090

            // order list is choosed

091

        case '4':

092

            {

093

                orderListPage(price, item, k); // order list displayed

094

                break;

095

            }

096

097

        }                       // switch finished

098

099

        // while loop will b continued if i!=5..will again pop up menu page

100

    }

101

102

    exitPage();                 // out of while if i==5..exiting message

103

    getch();

104

    return 0;

105

}

106

107

108

109

void pizzaPage(float p[10], char *itm[20], int k)

110

{

111

    int i, j;

112

    char ch;

113

    // clrscr();

114

115

    // display of pizza menu starts

116

    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

117

118

    printf(" ");

119

    for (i = 0; i < 58; i++)

120

        printf("*");

121

122

    for (j = 0; j < 2; j++)

123

    {

124

        printf(" **");

125

        for (i = 0; i < 54; i++)

126

            printf(" ");

127

        printf("**");

128

    }

129

130

    printf(" ** Menu Selection >> Pizzas ** ");

131

132

    for (j = 0; j < 2; j++)

133

    {

134

        printf(" **");

135

        for (i = 0; i < 54; i++)

136

            printf(" ");

137

        printf("**");

138

    }

139

140

    printf(" ");

141

    for (i = 0; i < 58; i++)

142

        printf("*");

143

144

    for (j = 0; j < 2; j++)

145

    {

146

        printf(" **");

147

        for (i = 0; i < 54; i++)

148

            printf(" ");

149

        printf("**");

150

    }

151

152

    printf(" ** Item Name Price ** ");

153

    for (j = 0; j < 3; j++)

154

    {

155

        printf(" **");

156

        for (i = 0; i < 54; i++)

157

            printf(" ");

158

        printf("**");

159

    }

160

161

    printf(" ** 1.Meat Lovers $ 12.75 ** ");

162

    for (j = 0; j < 2; j++)

163

    {

164

        printf(" **");

165

        for (i = 0; i < 54; i++)

166

            printf(" ");

167

        printf("**");

168

    }

169

170

    printf(" ** 2.Vege Delight $ 9.50 ** ");

171

    for (j = 0; j < 2; j++)

172

    {

173

        printf(" **");

174

        for (i = 0; i < 54; i++)

175

            printf(" ");

176

        printf("**");

177

    }

178

179

    printf(" ** 3.Tauranga Special $ 12.00 ** ");

180

    for (j = 0; j < 2; j++)

181

    {

182

        printf(" **");

183

        for (i = 0; i < 54; i++)

184

            printf(" ");

185

        printf("**");

186

    }

187

188

    printf(" ");

189

    for (i = 0; i < 58; i++)

190

        printf("*");

191

192

193

    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

194

    // display of pizza menu ends

195

196

197

198

    // order receiving

199

    printf(" Please Enter Your Selection        : ");

200

    scanf("%d", &i);

201

    printf(" Quantity        : ");

202

    scanf("%d", &j);

203

    printf(" Do you want to order other Pizza <y/n> : ");

204

    scanf("%c", &ch);           // y if want to order more from pizzapage

205

206

    getch();

207

208

209

    // switch for pizza menu

210

    switch (i)

211

    {

212

    case 1:

213

        {

214

            // if meat lovers selected,p[k] will contain price

215

            // itm[k] will contain item name

216

217

            p[k++] = 12.75 * j; // j is the no of meat lovers pizza ordered

218

            itm[k++] = "Meat Lovers";

219

            break;

220

        }

221

222

    case 2:

223

        {

224

            // same as above if vege delight selected

225

226

            p[k++] = 9.50 * j;

227

            itm[k++] = "Vege Delight";

228

            break;

229

        }

230

231

    case 3:

232

        {

233

            // same if tarunga pizza selected

234

            p[k++] = 12.00 * j;

235

            itm[k++] = "Tauranga Special";

236

            break;

237

        }

238

    }

239

240

    // if want to order more pizza then pop up pizza menu again

241

    if (ch == 'y')

242

    {

243

        pizzaPage(p, itm, k);

244

    }

245

246

    // if not then return to main method

247

    else if (ch == 'n')

248

    {

249

        return;

250

    }

251

252

}

253

254

255

void sidesPage(float p[10], char *itm[20], int k)

256

{

257

    char ch;

258

    int i, j;

259

    // clrscr();

260

261

262

    // same as above

263

    // display part starts

264

    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

265

266

267

    printf(" ");

268

    for (i = 0; i < 58; i++)

269

        printf("*");

270

271

    for (j = 0; j < 2; j++)

272

    {

273

        printf(" **");

274

        for (i = 0; i < 54; i++)

275

            printf(" ");

276

        printf("**");

277

    }

278

279

    printf(" ** Menu Selection >> Sides ** ");

280

281

    for (j = 0; j < 2; j++)

282

    {

283

        printf(" **");

284

        for (i = 0; i < 54; i++)

285

            printf(" ");

286

        printf("**");

287

    }

288

289

    printf(" ");

290

    for (i = 0; i < 58; i++)

291

        printf("*");

292

293

    for (j = 0; j < 2; j++)

294

    {

295

        printf(" **");

296

        for (i = 0; i < 54; i++)

297

            printf(" ");

298

        printf("**");

299

    }

300

301

    printf(" ** Item Name Price ** ");

302

    for (j = 0; j < 3; j++)

303

    {

304

        printf(" **");

305

        for (i = 0; i < 54; i++)

306

            printf(" ");

307

        printf("**");

308

    }

309

310

    printf(" ** 1.Fries    $ 3.00 ** ");

311

    for (j = 0; j < 2; j++)

312

    {

313

        printf(" **");

314

        for (i = 0; i < 54; i++)

315

            printf(" ");

316

        printf("**");

317

    }

318

319

    printf(" ** 2.Chicken Wings $ 5.50 ** ");

320

    for (j = 0; j < 2; j++)

321

    {

322

        printf(" **");

323

        for (i = 0; i < 54; i++)

324

            printf(" ");

325

        printf("**");

326

    }

327

328

    printf(" ** 3.Chicken Nuggets $ 4.00 ** ");

329

    for (j = 0; j < 2; j++)

330

    {

331

        printf(" **");

332

        for (i = 0; i < 54; i++)

333

            printf(" ");

334

        printf("**");

335

    }

336

337

    printf(" ");

338

    for (i = 0; i < 58; i++)

339

        printf("*");

340

341

    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

#include<stdio.h>

002

#include<conio.h>

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